pub struct ShortEventId(/* private fields */);Expand description
ShortEventId is short (16B) because it is always used in a context of an existing
id::RostraId so even though client might potentially grind collisions
(64-bits of resistance) it really gains them nothing.
One might think of a FullEventId = (RostraId, EventId), where
the RostraId is passed separately or known in the context.
However non-naive applications should probably store event in a smarter way anyway, e.g. by first 8B mapping to a sequence of matching events.
Implementations§
Source§impl ShortEventId
impl ShortEventId
pub fn random() -> ShortEventId
Source§impl ShortEventId
impl ShortEventId
pub const ZERO: ShortEventId
pub const MAX: ShortEventId
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn from_bytes(bytes: [u8; 16]) -> ShortEventId
pub fn to_bytes(self) -> [u8; 16]
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for ShortEventId
impl<'__de, __Context> BorrowDecode<'__de, __Context> for ShortEventId
Source§fn borrow_decode<__D>(decoder: &mut __D) -> Result<ShortEventId, DecodeError>where
__D: BorrowDecoder<'__de, Context = __Context>,
fn borrow_decode<__D>(decoder: &mut __D) -> Result<ShortEventId, DecodeError>where
__D: BorrowDecoder<'__de, Context = __Context>,
Attempt to decode this type with the given BorrowDecode.
Source§impl Clone for ShortEventId
impl Clone for ShortEventId
Source§fn clone(&self) -> ShortEventId
fn clone(&self) -> ShortEventId
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ShortEventId
Source§impl Debug for ShortEventId
impl Debug for ShortEventId
Source§impl<__Context> Decode<__Context> for ShortEventId
impl<__Context> Decode<__Context> for ShortEventId
Source§fn decode<__D>(decoder: &mut __D) -> Result<ShortEventId, DecodeError>where
__D: Decoder<Context = __Context>,
fn decode<__D>(decoder: &mut __D) -> Result<ShortEventId, DecodeError>where
__D: Decoder<Context = __Context>,
Attempt to decode this type with the given Decode.
Source§impl Default for ShortEventId
impl Default for ShortEventId
Source§fn default() -> ShortEventId
fn default() -> ShortEventId
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ShortEventId
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ShortEventId
Available on crate feature
serde only.Source§fn deserialize<D>(d: D) -> Result<ShortEventId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<ShortEventId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ShortEventId
impl Display for ShortEventId
Source§impl Encode for ShortEventId
impl Encode for ShortEventId
impl Eq for ShortEventId
Source§impl From<EventId> for ShortEventId
impl From<EventId> for ShortEventId
Source§fn from(value: EventId) -> ShortEventId
fn from(value: EventId) -> ShortEventId
Converts to this type from the input type.
Source§impl FromStr for ShortEventId
impl FromStr for ShortEventId
Source§type Err = DecodeError
type Err = DecodeError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<ShortEventId, <ShortEventId as FromStr>::Err>
fn from_str(s: &str) -> Result<ShortEventId, <ShortEventId as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for ShortEventId
impl Hash for ShortEventId
Source§impl Ord for ShortEventId
impl Ord for ShortEventId
Source§fn cmp(&self, other: &ShortEventId) -> Ordering
fn cmp(&self, other: &ShortEventId) -> Ordering
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 PartialEq for ShortEventId
impl PartialEq for ShortEventId
Source§impl PartialOrd for ShortEventId
impl PartialOrd for ShortEventId
Source§impl Serialize for ShortEventId
Available on crate feature serde only.
impl Serialize for ShortEventId
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: 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 ShortEventId
Source§impl ToShort for ShortEventId
impl ToShort for ShortEventId
type ShortId = ShortEventId
fn to_short(self) -> <ShortEventId as ToShort>::ShortId
Auto Trait Implementations§
impl Freeze for ShortEventId
impl RefUnwindSafe for ShortEventId
impl Send for ShortEventId
impl Sync for ShortEventId
impl Unpin for ShortEventId
impl UnsafeUnpin for ShortEventId
impl UnwindSafe for ShortEventId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<F, T> ExpectFrom<F> for T
impl<F, T> ExpectFrom<F> for T
fn expect_from(other: F) -> T
Source§impl<F, I> ExpectInto<I> for Fwhere
I: ExpectFrom<F>,
impl<F, I> ExpectInto<I> for Fwhere
I: ExpectFrom<F>,
fn expect_into(self) -> I
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.