pub struct LocalJson { /* private fields */ }
Expand description
A MetadataGenerator
that consults stored JSON files in the local
filesystem.
§Notes
Files must be stored at contract.json
for contract-level metadata, and
{token-id}.json
for tokens, where token-id
is the string representation
of the decimal token id. e.g. 0.json
, 384510.json
, etc
This generator caches files in memory the first time they’re opened. If NFT metadata changes, the server will need to be re-booted to clear the cache. In addition, if you’re serving an egregious number of NFTs (or have large image-data properties), you may run out of memory as the cache grows
Implementations§
Trait Implementations§
Source§impl MetadataGenerator for LocalJson
impl MetadataGenerator for LocalJson
Source§type Error = LocalJsonError
type Error = LocalJsonError
Associated Error type
Source§fn metadata_for<'life0, 'async_trait>(
&'life0 self,
token_id: U256,
) -> Pin<Box<dyn Future<Output = Result<Option<NftMetadata>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn metadata_for<'life0, 'async_trait>(
&'life0 self,
token_id: U256,
) -> Pin<Box<dyn Future<Output = Result<Option<NftMetadata>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate metadata for a specific token
Source§fn contract_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<ContractMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn contract_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<ContractMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate contract-level metadata (in the OpenSea format). See
ContractMetadata
. Read moreAuto Trait Implementations§
impl !Freeze for LocalJson
impl !RefUnwindSafe for LocalJson
impl Send for LocalJson
impl Sync for LocalJson
impl Unpin for LocalJson
impl UnwindSafe for LocalJson
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> 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> 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