pub struct Profile {
pub id: u16,
pub name: Box<str>,
pub display_name: Box<str>,
pub banner: Box<str>,
pub avatar: Box<str>,
pub about: Box<str>,
pub last_updated: u32,
pub flags: ProfileFlags,
pub avatar_cached: Box<str>,
pub banner_cached: Box<str>,
pub extras: Option<Box<ProfileExtras>>,
}Expand description
Internal profile with u16 interner handle. All string fields use Box<str>
(16B) instead of String (24B) — profile strings are write-once from metadata.
Fields§
§id: u16§name: Box<str>§display_name: Box<str>§avatar: Box<str>§about: Box<str>§last_updated: u32§flags: ProfileFlags§avatar_cached: Box<str>§extras: Option<Box<ProfileExtras>>Rarely-set fields (lightning, nip05, website, local nickname, live status),
boxed out of the hot struct: most Vector profiles set none of these, so the
common case pays one null pointer instead of eight inline Box<str> headers
(the struct shrinks 248B -> 128B, and empty seen-but-unfetched placeholders
with it since empty Box<str> fields carry no heap).
Implementations§
Source§impl Profile
impl Profile
pub fn new() -> Self
pub fn nickname(&self) -> &str
pub fn lud06(&self) -> &str
pub fn lud16(&self) -> &str
pub fn nip05(&self) -> &str
pub fn website(&self) -> &str
pub fn status_title(&self) -> &str
pub fn status_purpose(&self) -> &str
pub fn status_url(&self) -> &str
Sourcepub fn extras_mut(&mut self) -> &mut ProfileExtras
pub fn extras_mut(&mut self) -> &mut ProfileExtras
Materialize the extras box for writing a cold field (allocates on first set).
Sourcepub fn from_metadata(&mut self, meta: Metadata) -> bool
pub fn from_metadata(&mut self, meta: Metadata) -> bool
Merge Nostr Metadata into this Profile. Returns true if any fields changed.
Trait Implementations§
impl StructuralPartialEq for Profile
Auto Trait Implementations§
impl Freeze for Profile
impl RefUnwindSafe for Profile
impl Send for Profile
impl Sync for Profile
impl Unpin for Profile
impl UnsafeUnpin for Profile
impl UnwindSafe for Profile
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more