pub struct EventId(/* private fields */);Expand description
32-byte event identifier (SHA-256 of the canonical event serialization).
Display and serde use lowercase 64-char hex.
Implementations§
Source§impl EventId
impl EventId
Sourcepub const fn from_byte_array(bytes: [u8; 32]) -> Self
pub const fn from_byte_array(bytes: [u8; 32]) -> Self
Construct from a fixed-size byte array.
Sourcepub fn from_slice(bytes: &[u8]) -> Result<Self, EventIdError>
pub fn from_slice(bytes: &[u8]) -> Result<Self, EventIdError>
Construct from a byte slice.
§Errors
Returns EventIdError::InvalidLength when the slice is not 32 bytes.
Sourcepub fn parse<S>(input: S) -> Result<Self, EventIdError>
pub fn parse<S>(input: S) -> Result<Self, EventIdError>
Sourcepub fn compute_from_canonical(canonical: &[u8]) -> Self
pub fn compute_from_canonical(canonical: &[u8]) -> Self
Compute an EventId from the canonical event serialization bytes.
The caller must produce the exact byte sequence described by NIP-01. This function does not validate the structure; it only hashes.
Sourcepub const fn to_byte_array(self) -> [u8; 32]
pub const fn to_byte_array(self) -> [u8; 32]
Return the 32-byte representation.
Trait Implementations§
impl Copy for EventId
Source§impl<'de> Deserialize<'de> for EventId
impl<'de> Deserialize<'de> for EventId
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EventId
Source§impl FromBech32 for EventId
impl FromBech32 for EventId
Source§fn from_bech32(s: &str) -> Result<Self, FromBech32Error>
fn from_bech32(s: &str) -> Result<Self, FromBech32Error>
Parse the given NIP-19 bech32 string. Read more
Source§impl FromNostrUri for EventId
impl FromNostrUri for EventId
Source§fn from_nostr_uri(uri: &str) -> Result<Self, Nip21Error>
fn from_nostr_uri(uri: &str) -> Result<Self, Nip21Error>
Source§impl Ord for EventId
impl Ord for EventId
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 EventId
impl PartialOrd for EventId
impl StructuralPartialEq for EventId
Source§impl ToNostrUri for EventId
impl ToNostrUri for EventId
Source§fn to_nostr_uri(&self) -> Result<String, Nip21Error>
fn to_nostr_uri(&self) -> Result<String, Nip21Error>
Produce the
nostr:<bech32> URI for this value. Read moreAuto Trait Implementations§
impl Freeze for EventId
impl RefUnwindSafe for EventId
impl Send for EventId
impl Sync for EventId
impl Unpin for EventId
impl UnsafeUnpin for EventId
impl UnwindSafe for EventId
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,
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.