pub struct ReactionTarget {
pub event_id: EventId,
pub author: PublicKey,
pub kind: Option<Kind>,
pub coordinate: Option<Coordinate>,
pub relay_hint: Option<RelayUrl>,
}Expand description
What a kind: 7 reaction points at.
event_id and author are mandatory because NIP-25 mandates the
e and SHOULD-mandates the p tags. kind is the reacted event’s
kind for the optional k tag, coordinate is set when the
reacted event is addressable (30000..40000), and relay_hint is
the optional relay-hint slot that goes onto every tag where it is
applicable.
Fields§
§event_id: EventIdSHA-256 id of the reacted event.
Author of the reacted event.
kind: Option<Kind>Kind of the reacted event, surfaced via the k tag.
coordinate: Option<Coordinate>Addressable coordinate for replaceable / addressable events.
relay_hint: Option<RelayUrl>Relay hint propagated to the e / a / p tags.
Implementations§
Source§impl ReactionTarget
impl ReactionTarget
Sourcepub const fn new(event_id: EventId, author: PublicKey) -> Self
pub const fn new(event_id: EventId, author: PublicKey) -> Self
Build a target from the bare (event_id, author) pair.
Use the with_* builders to layer on the optional NIP-25
hints.
Sourcepub fn from_event(event: &Event) -> Self
pub fn from_event(event: &Event) -> Self
Capture every NIP-25 hint from a fully-resolved reacted event.
This is the recommended way to construct a target because it
fills in kind and (when the kind is addressable) the
coordinate from the reacted event’s d tag.
Sourcepub fn with_relay_hint(self, relay: RelayUrl) -> Self
pub fn with_relay_hint(self, relay: RelayUrl) -> Self
Attach a relay hint that the resulting reaction event will
propagate onto its e / a / p tags.
Sourcepub const fn with_kind(self, kind: Kind) -> Self
pub const fn with_kind(self, kind: Kind) -> Self
Override the kind field (rarely needed once
Self::from_event has populated it).
Sourcepub fn with_coordinate(self, coordinate: Coordinate) -> Self
pub fn with_coordinate(self, coordinate: Coordinate) -> Self
Override the addressable coordinate.
Trait Implementations§
Source§impl Clone for ReactionTarget
impl Clone for ReactionTarget
Source§fn clone(&self) -> ReactionTarget
fn clone(&self) -> ReactionTarget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReactionTarget
impl Debug for ReactionTarget
impl Eq for ReactionTarget
Source§impl Hash for ReactionTarget
impl Hash for ReactionTarget
Source§impl PartialEq for ReactionTarget
impl PartialEq for ReactionTarget
impl StructuralPartialEq for ReactionTarget
Auto Trait Implementations§
impl Freeze for ReactionTarget
impl RefUnwindSafe for ReactionTarget
impl Send for ReactionTarget
impl Sync for ReactionTarget
impl Unpin for ReactionTarget
impl UnsafeUnpin for ReactionTarget
impl UnwindSafe for ReactionTarget
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
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> 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.