Skip to main content

Registry

Struct Registry 

Source
pub struct Registry { /* private fields */ }
Expand description

The providers a host’s build includes, highest priority first.

Implementations§

Source§

impl Registry

Source

pub fn with_defaults() -> Self

A registry of every provider this build includes, in the default priority: SVG, animated images, Lottie, then OpenEXR.

Source

pub fn register(&mut self, provider: Box<dyn VisualProvider>)

Adds provider after those already registered.

Source

pub fn names(&self) -> Vec<&'static str>

The registered providers’ names, in priority order.

Source

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.

Source

pub fn supports(&self, source: &ProviderSource) -> bool

Whether this build opens source.

Source

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.

Source

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.

Source

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§

Source§

impl Default for Registry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.