pub struct HandlerRecommendation {
pub recommended_kind: Kind,
pub entries: Vec<HandlerRecommendationEntry>,
pub extra_tags: Vec<Tag>,
}Expand description
Typed bundle for a kind: 31989 recommendation event.
Fields§
§recommended_kind: KindKind being recommended (encodes as the d tag value).
entries: Vec<HandlerRecommendationEntry>Recommendation rows in the order the producer pinned them.
Forward-compatible passthrough for unknown tags.
Implementations§
Source§impl HandlerRecommendation
impl HandlerRecommendation
Sourcepub fn entry(self, entry: HandlerRecommendationEntry) -> Self
pub fn entry(self, entry: HandlerRecommendationEntry) -> Self
Append a recommendation entry.
Sourcepub fn coordinate(&self, author: PublicKey) -> Coordinate
pub fn coordinate(&self, author: PublicKey) -> Coordinate
Build the addressable coordinate for this recommendation.
Sourcepub fn from_event(event: &Event) -> Result<Self, HandlerError>
pub fn from_event(event: &Event) -> Result<Self, HandlerError>
Parse a kind: 31989 event back into a typed bundle.
§Errors
HandlerError::WrongKindfor any other kind.HandlerError::MissingIdentifierwhen thedtag is absent.HandlerError::InvalidRecommendedKindwhen thedvalue is not au16.- Per-entry parser errors propagate as-is.
Trait Implementations§
Source§impl Clone for HandlerRecommendation
impl Clone for HandlerRecommendation
Source§fn clone(&self) -> HandlerRecommendation
fn clone(&self) -> HandlerRecommendation
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 moreSource§impl Debug for HandlerRecommendation
impl Debug for HandlerRecommendation
impl Eq for HandlerRecommendation
Source§impl PartialEq for HandlerRecommendation
impl PartialEq for HandlerRecommendation
impl StructuralPartialEq for HandlerRecommendation
Auto Trait Implementations§
impl Freeze for HandlerRecommendation
impl RefUnwindSafe for HandlerRecommendation
impl Send for HandlerRecommendation
impl Sync for HandlerRecommendation
impl Unpin for HandlerRecommendation
impl UnsafeUnpin for HandlerRecommendation
impl UnwindSafe for HandlerRecommendation
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> 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.