pub struct ExternalType { /* private fields */ }Expand description
A codec template for an external Rust type.
Templates are built once at registration time;
type arguments are filled in per use site via CodecExpr::Param placeholders.
Implementations§
Source§impl ExternalType
impl ExternalType
Sourcepub fn generic1(build: impl FnOnce(CodecExpr) -> CodecExpr) -> Self
pub fn generic1(build: impl FnOnce(CodecExpr) -> CodecExpr) -> Self
A type with one type parameter.
The closure runs once with Param(0) to build the template.
Sourcepub fn generic2(build: impl FnOnce(CodecExpr, CodecExpr) -> CodecExpr) -> Self
pub fn generic2(build: impl FnOnce(CodecExpr, CodecExpr) -> CodecExpr) -> Self
A type with two type parameters.
The closure runs once with Param(0) and Param(1).
Sourcepub fn generic(
arity: usize,
build: impl FnOnce(&[CodecExpr]) -> CodecExpr,
) -> Self
pub fn generic( arity: usize, build: impl FnOnce(&[CodecExpr]) -> CodecExpr, ) -> Self
A type with arity type parameters.
The closure runs once with [Param(0), ..., Param(arity - 1)].
§Panics
Panics if the produced template references a Param index >= arity.
Sourcepub fn allow_trailing_args(self) -> Self
pub fn allow_trailing_args(self) -> Self
Accept (and ignore) extra trailing type arguments beyond the declared arity.
e.g. the hasher parameter of HashMap<K, V, S>.
Trait Implementations§
Source§impl Clone for ExternalType
impl Clone for ExternalType
Source§fn clone(&self) -> ExternalType
fn clone(&self) -> ExternalType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExternalType
impl RefUnwindSafe for ExternalType
impl Send for ExternalType
impl Sync for ExternalType
impl Unpin for ExternalType
impl UnsafeUnpin for ExternalType
impl UnwindSafe for ExternalType
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
Mutably borrows from an owned value. Read more