pub struct CommunityDefinition {
pub identifier: String,
pub name: Option<String>,
pub description: Option<String>,
pub image: Option<CommunityImage>,
pub moderators: Vec<CommunityModerator>,
pub relays: Vec<CommunityRelay>,
pub extra_tags: Vec<Tag>,
}Expand description
Typed bundle for a kind: 34550 community definition.
Fields§
§identifier: Stringd tag identifier (the (pubkey, 34550, d) coordinate’s d).
name: Option<String>name tag (defaults to the identifier when absent).
description: Option<String>description tag.
image: Option<CommunityImage>image tag.
moderators: Vec<CommunityModerator>Moderators (p tags with the "moderator" marker).
relays: Vec<CommunityRelay>Relay tags (with optional markers).
Forward-compatible passthrough of any other tags rows.
Implementations§
Source§impl CommunityDefinition
impl CommunityDefinition
Sourcepub fn new(identifier: impl Into<String>) -> Self
pub fn new(identifier: impl Into<String>) -> Self
Construct a community definition with only the d identifier
set.
Sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
Set Self::name.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set Self::description.
Sourcepub fn image(self, image: CommunityImage) -> Self
pub fn image(self, image: CommunityImage) -> Self
Set Self::image.
Sourcepub fn moderator(self, m: CommunityModerator) -> Self
pub fn moderator(self, m: CommunityModerator) -> Self
Append one moderator.
Sourcepub fn relay(self, r: CommunityRelay) -> Self
pub fn relay(self, r: CommunityRelay) -> Self
Append one relay.
Render to the tag list of a kind: 34550 event.
Sourcepub fn from_event(event: &Event) -> Result<Self, CommunityError>
pub fn from_event(event: &Event) -> Result<Self, CommunityError>
Parse a kind: 34550 event back into a typed bundle.
§Errors
CommunityError::WrongKindfor any other kind.CommunityError::MissingIdentifierwhen nodtag.CommunityError::InvalidPublicKey/CommunityError::InvalidRelayUrl/CommunityError::InvalidImageDimfor malformed values.
Sourcepub fn coordinate(&self, author: PublicKey) -> Coordinate
pub fn coordinate(&self, author: PublicKey) -> Coordinate
Build the community’s addressable coordinate.
author is the community owner’s pubkey (the event creator).
Trait Implementations§
Source§impl Clone for CommunityDefinition
impl Clone for CommunityDefinition
Source§fn clone(&self) -> CommunityDefinition
fn clone(&self) -> CommunityDefinition
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 CommunityDefinition
impl Debug for CommunityDefinition
impl Eq for CommunityDefinition
Source§impl PartialEq for CommunityDefinition
impl PartialEq for CommunityDefinition
impl StructuralPartialEq for CommunityDefinition
Auto Trait Implementations§
impl Freeze for CommunityDefinition
impl RefUnwindSafe for CommunityDefinition
impl Send for CommunityDefinition
impl Sync for CommunityDefinition
impl Unpin for CommunityDefinition
impl UnsafeUnpin for CommunityDefinition
impl UnwindSafe for CommunityDefinition
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.