pub struct Id(/* private fields */);Expand description
A Sew entity id. Invariant: 1 ..= i64::MAX.
Implementations§
Source§impl Id
impl Id
Sourcepub const fn new_const(v: u64) -> Id
pub const fn new_const(v: u64) -> Id
Wraps a constant. Panics (a compile error in const context) when the value is invalid.
Sourcepub const fn from_i64(v: i64) -> Option<Id>
pub const fn from_i64(v: i64) -> Option<Id>
Converts from a Postgres bigint. None for values below 1.
Sourcepub const fn from_parts(
ms_since_epoch: u64,
node: NodeId,
seq: u16,
) -> Option<Id>
pub const fn from_parts( ms_since_epoch: u64, node: NodeId, seq: u16, ) -> Option<Id>
Builds an id from its parts. None if a part is out of range or the result is 0.
Sourcepub const fn ms_since_epoch(self) -> u64
pub const fn ms_since_epoch(self) -> u64
Milliseconds since the Sew epoch.
Sourcepub fn min_for_time(t: Timestamp) -> Id
pub fn min_for_time(t: Timestamp) -> Id
The smallest id that can exist at t (for time-based cursors). Times before the epoch
give Id(1); times past the id range give the largest id.
Sourcepub fn max_for_time(t: Timestamp) -> Id
pub fn max_for_time(t: Timestamp) -> Id
The largest id that can exist at t.
Trait Implementations§
impl Copy for Id
Source§impl<'de> Deserialize<'de> for Id
impl<'de> Deserialize<'de> for Id
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Id, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Id, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Id
Source§impl JsonSchema for Id
impl JsonSchema for Id
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§impl Ord for Id
impl Ord for Id
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Id
impl PartialOrd for Id
Source§impl Serialize for Id
impl Serialize for Id
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Id
Auto Trait Implementations§
impl Forget for Id
impl Freeze for Id
impl Move for Id
impl RefUnwindSafe for Id
impl Send for Id
impl Sync for Id
impl Unpin for Id
impl UnsafeUnpin for Id
impl UnwindSafe for Id
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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