pub struct SourceRegistry { /* private fields */ }Expand description
Registry mapping URI schemes to opener functions. Each scheme picks
one of three opener kinds (bytes / packets / frames) at registration
time; callers see the choice via the SourceOutput variant
returned from open.
Implementations§
Source§impl SourceRegistry
impl SourceRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty registry. Callers must register at least one driver before
calling open. The conventional minimum is the
file driver (provided by the oxideav-source crate).
Sourcepub fn register_bytes(&mut self, scheme: &str, opener: OpenBytesFn)
pub fn register_bytes(&mut self, scheme: &str, opener: OpenBytesFn)
Register a BytesSource opener for a scheme. Schemes are
normalised to ASCII lowercase. Replaces any prior registration
(including registrations of other opener kinds).
Sourcepub fn register_packets(&mut self, scheme: &str, opener: OpenPacketsFn)
pub fn register_packets(&mut self, scheme: &str, opener: OpenPacketsFn)
Register a PacketSource opener for a scheme. Schemes are
normalised to ASCII lowercase. Replaces any prior registration
(including registrations of other opener kinds).
Sourcepub fn register_frames(&mut self, scheme: &str, opener: OpenFramesFn)
pub fn register_frames(&mut self, scheme: &str, opener: OpenFramesFn)
Register a FrameSource opener for a scheme. Schemes are
normalised to ASCII lowercase. Replaces any prior registration
(including registrations of other opener kinds).
Sourcepub fn open(&self, uri_str: &str) -> Result<SourceOutput>
pub fn open(&self, uri_str: &str) -> Result<SourceOutput>
Open a URI. The URI’s scheme determines which opener runs; bare
paths (no scheme) and unrecognised schemes both fall back to the
file driver if it is registered.
Returns a SourceOutput whose variant matches the registered
opener kind: bytes-shape drivers return SourceOutput::Bytes,
packet-shape drivers return SourceOutput::Packets, and so on.