pub struct Event { /* private fields */ }
Expand description
Event
struct
Implementations§
source§impl Event
impl Event
sourcepub fn new<I, S>(
id: EventId,
public_key: PublicKey,
created_at: Timestamp,
kind: Kind,
tags: I,
content: S,
sig: Signature
) -> Self
pub fn new<I, S>( id: EventId, public_key: PublicKey, created_at: Timestamp, kind: Kind, tags: I, content: S, sig: Signature ) -> Self
Compose event
sourcepub fn from_value(value: Value) -> Result<Self, Error>
pub fn from_value(value: Value) -> Result<Self, Error>
Get event author (pubkey
field)
Get event author reference (pubkey
field)
sourcepub fn created_at(&self) -> Timestamp
pub fn created_at(&self) -> Timestamp
Get Timestamp of when the event was created
Get reference to event tags
Iterate event tags
Iterate and consume event tags
sourcepub fn verify_with_ctx<C>(&self, secp: &Secp256k1<C>) -> Result<(), Error>where
C: Verification,
pub fn verify_with_ctx<C>(&self, secp: &Secp256k1<C>) -> Result<(), Error>where
C: Verification,
sourcepub fn verify_signature(&self) -> Result<(), Error>
Available on crate feature std
only.
pub fn verify_signature(&self) -> Result<(), Error>
std
only.Verify only event Signature
sourcepub fn verify_signature_with_ctx<C>(
&self,
secp: &Secp256k1<C>
) -> Result<(), Error>where
C: Verification,
pub fn verify_signature_with_ctx<C>(
&self,
secp: &Secp256k1<C>
) -> Result<(), Error>where
C: Verification,
Verify event Signature
sourcepub fn expiration(&self) -> Option<&Timestamp>
pub fn expiration(&self) -> Option<&Timestamp>
Get Timestamp
expiration if set
sourcepub fn is_expired(&self) -> bool
Available on crate feature std
only.
pub fn is_expired(&self) -> bool
std
only.Returns true
if the event has an expiration tag that is expired.
If an event has no Expiration
tag, then it will return false
.
sourcepub fn is_expired_with_supplier<T>(&self, supplier: &T) -> boolwhere
T: TimeSupplier,
pub fn is_expired_with_supplier<T>(&self, supplier: &T) -> boolwhere
T: TimeSupplier,
Returns true
if the event has an expiration tag that is expired.
If an event has no Expiration
tag, then it will return false
.
sourcepub fn is_expired_at(&self, now: &Timestamp) -> bool
pub fn is_expired_at(&self, now: &Timestamp) -> bool
Returns true
if the event has an expiration tag that is expired.
If an event has no Expiration
tag, then it will return false
.
sourcepub fn is_job_request(&self) -> bool
pub fn is_job_request(&self) -> bool
Check if Kind
is a NIP90 job request
sourcepub fn is_job_result(&self) -> bool
pub fn is_job_result(&self) -> bool
Check if Kind
is a NIP90 job result
sourcepub fn is_regular(&self) -> bool
pub fn is_regular(&self) -> bool
Check if event Kind
is Regular
sourcepub fn is_replaceable(&self) -> bool
pub fn is_replaceable(&self) -> bool
Check if event Kind
is Replaceable
sourcepub fn is_ephemeral(&self) -> bool
pub fn is_ephemeral(&self) -> bool
Check if event Kind
is Ephemeral
sourcepub fn is_parameterized_replaceable(&self) -> bool
pub fn is_parameterized_replaceable(&self) -> bool
Check if event Kind
is Parameterized replaceable
sourcepub fn identifier(&self) -> Option<&str>
pub fn identifier(&self) -> Option<&str>
Extract identifier (d
tag), if exists.
sourcepub fn public_keys(&self) -> impl Iterator<Item = &PublicKey>
pub fn public_keys(&self) -> impl Iterator<Item = &PublicKey>
Extract public keys from tags (p
tag)
This method extract ONLY TagStandard::PublicKey
sourcepub fn event_ids(&self) -> impl Iterator<Item = &EventId>
pub fn event_ids(&self) -> impl Iterator<Item = &EventId>
Extract event IDs from tags (e
tag)
This method extract ONLY TagStandard::Event
sourcepub fn coordinates(&self) -> impl Iterator<Item = &Coordinate>
pub fn coordinates(&self) -> impl Iterator<Item = &Coordinate>
Extract coordinates from tags (a
tag)
Available on crate feature std
only.
std
only.Get tags indexes
Trait Implementations§
source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
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>,
source§impl From<Event> for UnsignedEvent
impl From<Event> for UnsignedEvent
source§impl JsonUtil for Event
impl JsonUtil for Event
source§impl Ord for Event
impl Ord for Event
source§impl PartialEq for Event
impl PartialEq for Event
source§impl PartialOrd for Event
impl PartialOrd for Event
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
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
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key
and return true
if they are equal.