pub struct Event {
pub id: EventId,
pub pubkey: XOnlyPublicKey,
pub created_at: Timestamp,
pub kind: Kind,
pub tags: Vec<Tag, Global>,
pub content: String,
pub sig: Signature,
pub ots: Option<String>,
}
Expand description
Event
struct
Fields§
§id: EventId
Id
pubkey: XOnlyPublicKey
Author
created_at: Timestamp
Timestamp (seconds)
kind: Kind
Kind
Vector of Tag
content: String
Content
sig: Signature
Signature
ots: Option<String>
OpenTimestamps Attestations
Implementations§
source§impl Event
impl Event
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,
Verify event
sourcepub fn from_value_with_ctx<C>(
secp: &Secp256k1<C>,
value: Value
) -> Result<Event, Error>where
C: Verification,
pub fn from_value_with_ctx<C>( secp: &Secp256k1<C>, value: Value ) -> Result<Event, Error>where C: Verification,
New event from Value
sourcepub fn from_json<S>(json: S) -> Result<Event, Error>where
S: Into<String>,
pub fn from_json<S>(json: S) -> Result<Event, Error>where S: Into<String>,
New event from json string
sourcepub fn from_json_with_ctx<C, S>(
secp: &Secp256k1<C>,
json: S
) -> Result<Event, Error>where
C: Verification,
S: Into<String>,
pub fn from_json_with_ctx<C, S>( secp: &Secp256k1<C>, json: S ) -> Result<Event, Error>where C: Verification, S: Into<String>,
New event from json string
sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> 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_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 timestamp(&mut self) -> Result<(), Error>
pub fn timestamp(&mut self) -> Result<(), Error>
Timestamp this event with OpenTimestamps, according to NIP-03
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
Trait Implementations§
source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Event, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Event, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Event
impl Ord for Event
source§impl PartialEq<Event> for Event
impl PartialEq<Event> for Event
source§impl PartialOrd<Event> for Event
impl PartialOrd<Event> for Event
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for Event
impl Serialize for Event
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 Eq for Event
impl StructuralEq for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.