Struct Time

Source
pub struct Time(/* private fields */);
Expand description

Time is as the number of nanoseconds since the Unix epoch. The default value of Time is the Unix epoch 1970-01-01 00:00:00 UTC. This default may not be suitable for all applications, so wrap time in an Option.

Implementations§

Source§

impl Time

Source

pub const fn from_unix_nanos(time: i128) -> Time

Constructs a time instance with nanoseconds since the Unix epoch.

Source

pub const fn from_unix_secs(time: i64) -> Time

Constructs a time instance with seconds since the Unix epoch.

Source

pub const fn unix_nanos(&self) -> i128

Returns the number of nanoseconds since the Unix epoch.

Source

pub const fn add(self, duration: Duration) -> Time

Adds a duration to the time.

Source

pub const fn sub(self, duration: Duration) -> Time

Subtracts a duration from the time.

Source

pub const fn since(self, time: Time) -> Duration

Returns the duration elapsed since the other time.

Source

pub const fn until(self, time: Time) -> Duration

Returns the duration until the other time.

Trait Implementations§

Source§

impl Add<Duration> for Time

Source§

type Output = Time

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> <Time as Add<Duration>>::Output

Performs the + operation. Read more
Source§

impl AddAssign<Duration> for Time

Source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
Source§

impl Clone for Time

Source§

fn clone(&self) -> Time

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Time

Source§

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

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

impl Default for Time

Source§

fn default() -> Time

Returns the “default value” for a type. Read more
Source§

impl KeyFieldValue for Time

Source§

fn encode<'a>( key: &<Time as ObjectFieldValue>::In<'a>, writer: &mut ReverseSliceWriter<'_>, ) -> Result<(), EncodeError>

Encode the key segment as a non-terminal segment.
Source§

fn decode<'a>( reader: &mut &'a [u8], memory_manager: &'a MemoryManager, ) -> Result<<Time as ObjectFieldValue>::Out<'a>, DecodeError>

Decode the key segment as a non-terminal segment.
Source§

fn out_size<'a>(key: &<Time as ObjectFieldValue>::In<'a>) -> usize

Get the size of the key segment as a non-terminal segment.
Source§

fn encode_terminal<'a>( key: &Self::In<'a>, writer: &mut ReverseSliceWriter<'_>, ) -> Result<(), EncodeError>

Encode the key segment as the terminal segment.
Source§

fn decode_terminal<'a>( reader: &mut &'a [u8], memory_manager: &'a MemoryManager, ) -> Result<Self::Out<'a>, DecodeError>

Decode the key segment as the terminal segment.
Source§

fn out_size_terminal<'a>(key: &Self::In<'a>) -> usize

Get the size of the key segment as the terminal segment.
Source§

impl ObjectFieldValue for Time

Source§

type In<'a> = Time

The type that is used when inputting object values to functions.
Source§

type Out<'a> = Time

The type that is used in function return values.
Source§

impl Ord for Time

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · 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 Time

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 Time

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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<'a> SchemaValue<'a> for Time

Source§

type Type = TimeT

The type of the value.
Source§

type DecodeState = Time

In progress decoding state.
Source§

fn visit_decode_state( state: &mut <Time as SchemaValue<'a>>::DecodeState, decoder: &mut dyn Decoder<'a>, ) -> Result<(), DecodeError>

Decode the value from the decoder.
Source§

fn finish_decode_state( state: <Time as SchemaValue<'a>>::DecodeState, _: &'a MemoryManager, ) -> Result<Time, DecodeError>

Finish decoding the value, return it and return the memory handle if needed.
Source§

fn encode(&self, encoder: &mut dyn Encoder) -> Result<(), EncodeError>

Encode the value to the encoder.
Source§

impl Sub<Duration> for Time

Source§

type Output = Time

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> <Time as Sub<Duration>>::Output

Performs the - operation. Read more
Source§

impl Sub for Time

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Time) -> <Time as Sub>::Output

Performs the - operation. Read more
Source§

impl SubAssign<Duration> for Time

Source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
Source§

impl Copy for Time

Source§

impl Eq for Time

Source§

impl<'a> ListElementValue<'a> for Time

Source§

impl StructuralPartialEq for Time

Auto Trait Implementations§

§

impl Freeze for Time

§

impl RefUnwindSafe for Time

§

impl Send for Time

§

impl Sync for Time

§

impl Unpin for Time

§

impl UnwindSafe for Time

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<A> ObjectKey for A
where A: KeyFieldValue,

Source§

fn encode<'a>( key: &<A as ObjectValue>::In<'a>, writer: &mut ReverseSliceWriter<'_>, ) -> Result<(), EncodeError>

Encode the key.
Source§

fn decode<'a>( input: &'a [u8], memory_manager: &'a MemoryManager, ) -> Result<<A as ObjectValue>::Out<'a>, DecodeError>

Decode the key.
Source§

fn out_size<'a>(key: &<A as ObjectValue>::In<'a>) -> usize

Compute the output buffer size for the key.
Source§

impl<A> ObjectValue for A

Source§

const PSEUDO_TYPE: StructType<'static>

The associated “pseudo-struct” type for the object value.
Source§

type FieldTypes<'a> = (<<A as ObjectFieldValue>::In<'a> as SchemaValue<'a>>::Type,)

The object value types as field types.
Source§

type In<'a> = <A as ObjectFieldValue>::In<'a>

The type that is used when inputting object values to functions.
Source§

type Out<'a> = <A as ObjectFieldValue>::Out<'a>

The type that is used in function return values.
Source§

fn encode<'a>( value: &<A as ObjectValue>::In<'a>, encoder: &mut dyn Encoder, ) -> Result<(), EncodeError>

Encode each part of the value in reverse order.
Source§

fn decode<'a>( decoder: &mut dyn Decoder<'a>, mem: &'a MemoryManager, ) -> Result<<A as ObjectValue>::Out<'a>, DecodeError>

Decode the value from the decoder.
Source§

impl<'a, V> OptionalValue<'a> for V
where V: SchemaValue<'a>,

Source§

type Value = V

The value type that is returned.
Source§

fn decode_value( cdc: &dyn Codec, data: &'a [u8], memory_manager: &'a MemoryManager, ) -> Result<<V as OptionalValue<'a>>::Value, DecodeError>

Decode the value.
Source§

fn encode_value<'b>( cdc: &dyn Codec, value: &<V as OptionalValue<'a>>::Value, writer_factory: &'b dyn WriterFactory, ) -> Result<Option<&'b [u8]>, EncodeError>

Encode the value.
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<'a, T> ValueEncodeVisitor for T
where T: SchemaValue<'a>,

Source§

fn encode(&self, encoder: &mut dyn Encoder) -> Result<(), EncodeError>

Visit the value.
Source§

impl<T> NoDrop for T
where T: Copy,