Trait xylem::RcSchemaExt[][src]

pub trait RcSchemaExt: Schema { }
Expand description

Implement this trait for a schema type to support standard Rc conversion.

This allows Rc<T> to be converted from Box<T::From>, basically making the Rc wrapper transparent. The argument type is passed as-is.

Choice of the From associated type

The choice of Box instead of Rc in the From type considers the design goal where the From type is typically produced from deserialization directly, where the Rc wrapper is just a Box with some more overhead, where the underlying type cannot be moved out without a panic branch, in which case a Box would have just been more reasonable.

The reason for using Box<T> instead of T considers the possibility where T is a recursive type.

Implementors