pub struct ProtoDecoderRegistry { /* private fields */ }proto only.Expand description
A store of extension decoders, keyed by the trait they produce and the name the encoder wrote on the wire.
A session carries one registry, as a SessionConfig extension. Every
library that ships extension types adds its decoders to that registry with
SessionConfig::update_extension, which creates the registry if there is
none:
// in each library
pub fn register(config: &mut SessionConfig) -> Result<()> {
config.update_extension(MyExec::register_proto)?;
config.update_extension(MyExpr::register_proto)
}
// in the application that owns the session
let mut config = SessionConfig::new();
lib_one::register(&mut config)?;
lib_two::register(&mut config)?;Do not attach a registry with SessionConfig::with_extension: it replaces
the registry, so it discards the decoders that other libraries added.
The libraries need to know nothing about each other, and the order they are
called in does not matter: lookup is by name, and a real collision is an
error from register_decoder.
Callers normally reach this type through a kind’s typed facade rather than through the methods here.
Implementations§
Source§impl ProtoDecoderRegistry
impl ProtoDecoderRegistry
Sourcepub fn new() -> ProtoDecoderRegistry
pub fn new() -> ProtoDecoderRegistry
Create an empty registry.
Sourcepub fn register_decoder<Kind, T, D>(
&mut self,
name: &str,
decoder: D,
) -> Result<(), DataFusionError>
pub fn register_decoder<Kind, T, D>( &mut self, name: &str, decoder: D, ) -> Result<(), DataFusionError>
Register decoder under name, for extensions dispatched as Kind.
Kind is the trait object the decoder produces, such as
dyn ExecutionPlan. T is the concrete type being registered; it is
used only for identity, so that registering the same type twice is a
no-op while a different type under a taken name is an error. D is
the decoder itself, whose type the matching
decoder call must name exactly.
Sourcepub fn decoder<Kind, D>(&self, name: &str) -> Option<&D>
pub fn decoder<Kind, D>(&self, name: &str) -> Option<&D>
The decoder registered under name for extensions dispatched as Kind.
D must be the same type the matching
register_decoder call supplied. A different
D reads as “not registered” rather than as an error, because the two
calls are always made by the same facade.
Trait Implementations§
Source§impl Clone for ProtoDecoderRegistry
impl Clone for ProtoDecoderRegistry
Source§fn clone(&self) -> ProtoDecoderRegistry
fn clone(&self) -> ProtoDecoderRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtoDecoderRegistry
impl Debug for ProtoDecoderRegistry
Source§impl Default for ProtoDecoderRegistry
impl Default for ProtoDecoderRegistry
Source§fn default() -> ProtoDecoderRegistry
fn default() -> ProtoDecoderRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for ProtoDecoderRegistry
impl !UnwindSafe for ProtoDecoderRegistry
impl Forget for ProtoDecoderRegistry
impl Freeze for ProtoDecoderRegistry
impl Move for ProtoDecoderRegistry
impl Send for ProtoDecoderRegistry
impl Sync for ProtoDecoderRegistry
impl Unpin for ProtoDecoderRegistry
impl UnsafeUnpin for ProtoDecoderRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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