pub struct VoiceMessage {
pub is_reply: bool,
pub audio_url: Url,
pub media: Option<MediaAttachment>,
pub preview: VoicePreview,
pub extra_tags: Vec<Tag>,
}Expand description
Typed bundle for a kind: 1222 / kind: 1244 voice event.
Fields§
§is_reply: boolWhether this is a reply (true ⇒ kind: 1244).
audio_url: UrlURL pointing at the audio file (mirrors .content).
media: Option<MediaAttachment>Optional NIP-92 imeta tag describing the audio.
preview: VoicePreviewOptional preview parsed from the imeta tag.
Forward-compatible passthrough for unknown tags.
Implementations§
Source§impl VoiceMessage
impl VoiceMessage
Sourcepub fn media(self, media: MediaAttachment) -> Self
pub fn media(self, media: MediaAttachment) -> Self
Attach a NIP-92 media bundle. Side-extracts the
waveform/duration extras into Self::preview.
Sourcepub fn from_event(event: &Event) -> Result<Self, VoiceMessageError>
pub fn from_event(event: &Event) -> Result<Self, VoiceMessageError>
Parse a kind: 1222 or kind: 1244 voice-message event.
§Errors
See VoiceMessageError for the failure modes.
Trait Implementations§
Source§impl Clone for VoiceMessage
impl Clone for VoiceMessage
Source§fn clone(&self) -> VoiceMessage
fn clone(&self) -> VoiceMessage
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 VoiceMessage
impl Debug for VoiceMessage
impl Eq for VoiceMessage
Source§impl PartialEq for VoiceMessage
impl PartialEq for VoiceMessage
impl StructuralPartialEq for VoiceMessage
Auto Trait Implementations§
impl Freeze for VoiceMessage
impl RefUnwindSafe for VoiceMessage
impl Send for VoiceMessage
impl Sync for VoiceMessage
impl Unpin for VoiceMessage
impl UnsafeUnpin for VoiceMessage
impl UnwindSafe for VoiceMessage
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.