pub trait Owned: Introspect {
type Reader<'a>: FromPointerReader<'a> + SetterInput<Self>;
type Builder<'a>: FromPointerBuilder<'a>;
}
Expand description
A trait to encode relationships between readers and builders.
If Foo
is a Cap’n Proto struct and Bar
is a Rust-native struct, then
foo::Reader<'a>
is to foo::Owned
as &'a Bar
is to Bar
, and
foo::Builder<'a>
is to foo::Owned
as &'a mut Bar
is to Bar
.
The relationship is formalized by an impl capnp::traits::Owned for foo::Owned
.
Because Cap’n Proto struct layout differs from Rust struct layout, a foo::Owned
value
cannot be used for anything interesting on its own; the foo::Owned
type is useful
nonetheless as a type parameter, e.g. for a generic container that owns a Cap’n Proto
message of type T: capnp::traits::Owned
.
Required Associated Types§
type Reader<'a>: FromPointerReader<'a> + SetterInput<Self>
type Builder<'a>: FromPointerBuilder<'a>
Object Safety§
This trait is not object safe.