Skip to main content

DateTime

Struct DateTime 

Source
pub struct DateTime {
    pub year: i32,
    pub month: u8,
    pub day: u8,
    pub hour: u8,
    pub minute: u8,
    pub second: u8,
}
Expand description

Represents some time. Can be converted from chrono.

Fields§

§year: i32

The years since 0 CE

§month: u8

The month of the year 1-12

§day: u8

The day of the month 1-(28|30|31)

§hour: u8

The hour in the day 0-23

§minute: u8

The minute in the hour

§second: u8

The second in the minute

Implementations§

Source§

impl DateTime

Source

pub const fn new( year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, ) -> Self

Trait Implementations§

Source§

impl<'expr> AsExpression<Nullable<Timestamp>> for &'expr DateTime

Source§

type Expression = Bound<Nullable<Timestamp>, &'expr DateTime>

The expression being returned
Source§

fn as_expression(self) -> Self::Expression

Perform the conversion
Source§

impl AsExpression<Nullable<Timestamp>> for DateTime

Source§

type Expression = Bound<Nullable<Timestamp>, DateTime>

The expression being returned
Source§

fn as_expression(self) -> Self::Expression

Perform the conversion
Source§

impl<'expr> AsExpression<Timestamp> for &'expr DateTime

Source§

type Expression = Bound<Timestamp, &'expr DateTime>

The expression being returned
Source§

fn as_expression(self) -> Self::Expression

Perform the conversion
Source§

impl AsExpression<Timestamp> for DateTime

Source§

type Expression = Bound<Timestamp, DateTime>

The expression being returned
Source§

fn as_expression(self) -> Self::Expression

Perform the conversion
Source§

impl Clone for DateTime

Source§

fn clone(&self) -> DateTime

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DateTime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<DateTime> for Component

Available on crate feature read_write only.
Source§

fn from(dt: DateTime) -> Self

Converts to this type from the input type.
Source§

impl From<DateTime> for Option<NaiveDateTime>

Available on crate feature chrono only.
Source§

fn from(them: DateTime) -> Self

Converts to this type from the input type.
Source§

impl FromSql<Timestamp, Pg> for DateTime

Available on crate feature diesel only.
Source§

fn from_sql(bytes: Option<&[u8]>) -> Result<Self>

See the trait documentation.
Source§

impl<__ST, __DB> FromSqlRow<__ST, __DB> for DateTime
where __DB: Backend, Self: FromSql<__ST, __DB>,

Source§

fn build_from_row<R: Row<__DB>>(row: &mut R) -> Result<Self>

See the trait documentation.
Source§

const FIELDS_NEEDED: usize = 1

The number of fields that this type will consume. Must be equal to the number of times you would call row.take() in build_from_row
Source§

impl Ord for DateTime

Source§

fn cmp(&self, other: &DateTime) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for DateTime

Source§

fn eq(&self, other: &DateTime) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for DateTime

Source§

fn partial_cmp(&self, other: &DateTime) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<__ST, __DB> Queryable<__ST, __DB> for DateTime
where __DB: Backend, Self: FromSql<__ST, __DB>,

Source§

type Row = DateTime

The Rust type you’d like to map from. Read more
Source§

fn build(row: Self::Row) -> Self

Construct an instance of this type
Source§

impl<__DB> ToSql<Nullable<Timestamp>, __DB> for DateTime
where __DB: Backend, Self: ToSql<Timestamp, __DB>,

Source§

fn to_sql<W: Write>(&self, out: &mut Output<'_, W, __DB>) -> Result

See the trait documentation.
Source§

impl<DB> ToSql<Timestamp, DB> for DateTime

Available on crate feature diesel only.
Source§

fn to_sql<W: Write>(&self, out: &mut Output<'_, W, DB>) -> Result

See the trait documentation.
Source§

impl TryFrom<Component> for DateTime

Available on crate feature read_write only.
Source§

type Error = FromComponentError

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

fn try_from(comp: Component) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<NaiveDateTime> for DateTime

Available on crate feature chrono only.
Source§

type Error = TryFromIntError

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

fn try_from(dt: NaiveDateTime) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for DateTime

Source§

impl StructuralPartialEq for DateTime

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression
where Self: Sized + AsExpression<T>,

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V