pub struct Registry { /* private fields */ }Expand description
The providers a host’s build includes, highest priority first.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
A registry of every provider this build includes, in the default priority: SVG, animated images, Lottie, then OpenEXR.
Sourcepub fn register(&mut self, provider: Box<dyn VisualProvider>)
pub fn register(&mut self, provider: Box<dyn VisualProvider>)
Adds provider after those already registered.
Sourcepub fn probe(
&self,
bytes: &[u8],
) -> Option<Result<(&'static str, ProbeReport), ExtensionError>>
pub fn probe( &self, bytes: &[u8], ) -> Option<Result<(&'static str, ProbeReport), ExtensionError>>
What the first provider that claims bytes finds, or None when none
does. A provider that claims them and fails answers with its error:
another provider is not tried in its place.
Sourcepub fn supports(&self, source: &ProviderSource) -> bool
pub fn supports(&self, source: &ProviderSource) -> bool
Whether this build opens source.
Sourcepub const fn reads_image_sequences() -> bool
pub const fn reads_image_sequences() -> bool
Whether this build reads image sequences. They have no provider to
register (each frame is a PNG or an OpenEXR image), so
Self::names cannot say.
Sourcepub fn open_needs(&self, source: &ProviderSource) -> Vec<String>
pub fn open_needs(&self, source: &ProviderSource) -> Vec<String>
The resources opening source reads, by locator: an image
sequence’s first frame. A host that registers resources only while
they are used registers these before Self::open.
Sourcepub fn open(
&self,
source: &ProviderSource,
bytes: Option<Arc<[u8]>>,
resolver: SharedResolver,
) -> Result<Box<dyn VisualSource>, ExtensionError>
pub fn open( &self, source: &ProviderSource, bytes: Option<Arc<[u8]>>, resolver: SharedResolver, ) -> Result<Box<dyn VisualSource>, ExtensionError>
Opens a project’s provider source: the bytes at its locator (none for
an image sequence, whose frames resolver supplies). The bytes must
be what the project says they are. An image sequence keeps
resolver and reads each frame from it as it shows it; other
providers read what they need while they open.
The source renders through the same panic boundary: a render that panics fails, and so does every later one, without running the provider’s code again on state the panic left behind.
§Errors
ExtensionError::Unsupported when this build has no provider for
it, ExtensionError::Mismatch when the bytes are another format,
or why the provider cannot open them (ExtensionError::Malformed
when it panicked).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Registry
impl !UnwindSafe for Registry
impl Freeze for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().