pub struct FileMetadata {Show 15 fields
pub url: UncheckedUrl,
pub m: Option<String>,
pub x: Option<String>,
pub ox: Option<String>,
pub size: Option<u64>,
pub dim: Option<(usize, usize)>,
pub magnet: Option<UncheckedUrl>,
pub i: Option<String>,
pub blurhash: Option<String>,
pub thumb: Option<UncheckedUrl>,
pub image: Option<UncheckedUrl>,
pub summary: Option<String>,
pub alt: Option<String>,
pub fallback: Vec<UncheckedUrl>,
pub service: Option<String>,
}
Expand description
NIP-92/94 File Metadata
Fields§
§url: UncheckedUrl
The URL this metadata applies to
m: Option<String>
Mime type (lowercase), see https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
x: Option<String>
SHA-256 hex-encoded hash
ox: Option<String>
original SHA-256 hex-encoded hash prior to transformations
size: Option<u64>
Size of file in bytes
dim: Option<(usize, usize)>
Dimensions of the image
magnet: Option<UncheckedUrl>
Magnet URI
i: Option<String>
Torrent infohash
blurhash: Option<String>
Blurhash
thumb: Option<UncheckedUrl>
Thumbnail URL
image: Option<UncheckedUrl>
Preview image (same dimensions)
summary: Option<String>
Summary text
alt: Option<String>
Alt description
fallback: Vec<UncheckedUrl>
Fallback URLs
service: Option<String>
Service
Implementations§
source§impl FileMetadata
impl FileMetadata
sourcepub fn new(url: UncheckedUrl) -> FileMetadata
pub fn new(url: UncheckedUrl) -> FileMetadata
Create a new empty (except the URL) FileMetadata
sourcepub fn to_nip94_preevent(&self, pubkey: PublicKey) -> PreEvent
pub fn to_nip94_preevent(&self, pubkey: PublicKey) -> PreEvent
Create a NIP-94 FileMetadata PreEvent from this FileMetadata
sourcepub fn from_nip94_event(event: &Event) -> Option<FileMetadata>
pub fn from_nip94_event(event: &Event) -> Option<FileMetadata>
Turn a kind-1063 (FileMetadata) event into a FileMetadata structure
sourcepub fn to_imeta_tag(&self) -> Tag
pub fn to_imeta_tag(&self) -> Tag
Convert into an ‘imeta’ tag
sourcepub fn from_imeta_tag(tag: &Tag) -> Option<FileMetadata>
pub fn from_imeta_tag(tag: &Tag) -> Option<FileMetadata>
Import from an ‘imeta’ tag
Trait Implementations§
source§impl Clone for FileMetadata
impl Clone for FileMetadata
source§fn clone(&self) -> FileMetadata
fn clone(&self) -> FileMetadata
Returns a copy of the value. Read more
1.0.0 · 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 FileMetadata
impl Debug for FileMetadata
source§impl Hash for FileMetadata
impl Hash for FileMetadata
source§impl PartialEq for FileMetadata
impl PartialEq for FileMetadata
impl StructuralPartialEq for FileMetadata
Auto Trait Implementations§
impl Freeze for FileMetadata
impl RefUnwindSafe for FileMetadata
impl Send for FileMetadata
impl Sync for FileMetadata
impl Unpin for FileMetadata
impl UnwindSafe for FileMetadata
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)