Struct nft_server::generators::disk::LocalJson
source · [−]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
sourceimpl MetadataGenerator for LocalJson
impl MetadataGenerator for LocalJson
type Error = LocalJsonError
type Error = LocalJsonError
Associated Error type
sourcefn metadata_for<'life0, 'async_trait>(
&'life0 self,
token_id: U256
) -> Pin<Box<dyn Future<Output = Result<Option<NftMetadata>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: 'async_trait,
Generate metadata for a specific token
sourcefn contract_metadata<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<ContractMetadata>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn contract_metadata<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<ContractMetadata>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Generate contract-level metadata (in the OpenSea format). See
ContractMetadata. Read moreAuto Trait Implementations
impl !RefUnwindSafe for LocalJson
impl Send for LocalJson
impl Sync for LocalJson
impl Unpin for LocalJson
impl UnwindSafe for LocalJson
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more