Struct bson::datetime::DateTimeBuilder
source · pub struct DateTimeBuilder<Y = NoYear, M = NoMonth, D = NoDay> { /* private fields */ }
Expand description
Builder for constructing a BSON DateTime
Implementations§
source§impl<M, D> DateTimeBuilder<NoYear, M, D>
impl<M, D> DateTimeBuilder<NoYear, M, D>
sourcepub fn year(self, y: i32) -> DateTimeBuilder<Year, M, D>
pub fn year(self, y: i32) -> DateTimeBuilder<Year, M, D>
Sets the year for the builder instance. Years between ±9999 inclusive are valid.
If the specified value is out of range, calling the build()
method will return
an error.
Note: This is a required method. You will not be able to call build()
before calling
this method.
source§impl<Y, D> DateTimeBuilder<Y, NoMonth, D>
impl<Y, D> DateTimeBuilder<Y, NoMonth, D>
sourcepub fn month(self, m: u8) -> DateTimeBuilder<Y, Month, D>
pub fn month(self, m: u8) -> DateTimeBuilder<Y, Month, D>
Sets the month for the builder instance. Maps months as 1-January to 12-December.
If the specified value is out of range, calling the build()
method will return
an error.
Note: This is a required method. You will not be able to call build()
before calling
this method.
source§impl<Y, M> DateTimeBuilder<Y, M, NoDay>
impl<Y, M> DateTimeBuilder<Y, M, NoDay>
sourcepub fn day(self, d: u8) -> DateTimeBuilder<Y, M, Day>
pub fn day(self, d: u8) -> DateTimeBuilder<Y, M, Day>
Sets the day for the builder instance. Values in the range 1..=31
are valid.
If the specified value does not exist for the provided month/year or is out of range,
calling the build()
method will return an error.
Note: This is a required method. You will not be able to call build()
before calling
this method.
source§impl<Y, M, D> DateTimeBuilder<Y, M, D>
impl<Y, M, D> DateTimeBuilder<Y, M, D>
sourcepub fn hour(self, hour: u8) -> DateTimeBuilder<Y, M, D>
pub fn hour(self, hour: u8) -> DateTimeBuilder<Y, M, D>
Sets the hour (24-hour format) for the builder instance. Values must be in the range
0..=23
. If the specified value is out of range, calling the build()
method will
return an error.
Note: This is an optional method. The hour will default to 0 if not explicitly set.
sourcepub fn minute(self, minute: u8) -> DateTimeBuilder<Y, M, D>
pub fn minute(self, minute: u8) -> DateTimeBuilder<Y, M, D>
Sets the minute for the builder instance. Values must be in the range 0..=59
.
If the specified value is out of range, calling the build()
method will return an error.
Note: This is an optional method. The minute will default to 0 if not explicitly set.
sourcepub fn second(self, second: u8) -> DateTimeBuilder<Y, M, D>
pub fn second(self, second: u8) -> DateTimeBuilder<Y, M, D>
Sets the second for the builder instance. Values must be in range 0..=59
.
If the specified value is out of range, calling the build()
method will return an error.
Note: This is an optional method. The second will default to 0 if not explicitly set.
sourcepub fn millisecond(self, millisecond: u16) -> DateTimeBuilder<Y, M, D>
pub fn millisecond(self, millisecond: u16) -> DateTimeBuilder<Y, M, D>
Sets the millisecond for the builder instance. Values must be in the range 0..=999
.
If the specified value is out of range, calling the build()
method will return an error.
Note: This is an optional method. The millisecond will default to 0 if not explicitly set.
Trait Implementations§
Auto Trait Implementations§
impl<Y, M, D> Freeze for DateTimeBuilder<Y, M, D>
impl<Y, M, D> RefUnwindSafe for DateTimeBuilder<Y, M, D>
impl<Y, M, D> Send for DateTimeBuilder<Y, M, D>
impl<Y, M, D> Sync for DateTimeBuilder<Y, M, D>
impl<Y, M, D> Unpin for DateTimeBuilder<Y, M, D>
impl<Y, M, D> UnwindSafe for DateTimeBuilder<Y, M, D>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.