DateTimeBuilder

Struct DateTimeBuilder 

Source
pub struct DateTimeBuilder { /* private fields */ }

Implementations§

Source§

impl DateTimeBuilder

Source

pub const fn year(self, year: i64) -> Self

Sets the year component.

§Examples
use typwire::DateTime;

let dt = DateTime::builder().year(2025).build();
assert_eq!(dt.year, Some(2025));
Source

pub const fn month(self, month: i64) -> Self

Sets the month component.

§Examples
use typwire::DateTime;

let dt = DateTime::builder().month(12).build();
assert_eq!(dt.month, Some(12));
Source

pub const fn day(self, day: i64) -> Self

Sets the day component.

§Examples
use typwire::DateTime;

let dt = DateTime::builder().day(3).build();
assert_eq!(dt.day, Some(3));
Source

pub const fn hour(self, hour: i64) -> Self

Sets the hour component.

§Examples
use typwire::DateTime;

let dt = DateTime::builder().hour(14).build();
assert_eq!(dt.hour, Some(14));
Source

pub const fn minute(self, minute: i64) -> Self

Sets the minute component.

§Examples
use typwire::DateTime;

let dt = DateTime::builder().minute(30).build();
assert_eq!(dt.minute, Some(30));
Source

pub const fn second(self, second: i64) -> Self

Sets the second component.

§Examples
use typwire::DateTime;

let dt = DateTime::builder().second(45).build();
assert_eq!(dt.second, Some(45));
Source

pub const fn build(self) -> DateTime

Builds the DateTime instance from the configured components.

§Examples
use typwire::DateTime;

let dt = DateTime::builder()
    .year(2025)
    .month(12)
    .day(3)
    .hour(14)
    .minute(30)
    .second(45)
    .build();
assert_eq!(dt.year, Some(2025));
assert_eq!(dt.hour, Some(14));

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.