freedom_api

Trait Container

source
pub trait Container<T>: Deref<Target = T> + Value {
    // Required method
    fn into_inner(self) -> T;
}
Expand description

The trait defining the required functionality of container types

The Freedom API is generic over “containers”. Each implementer of the Api trait must also define a container. This is useful since certain clients will return Arc’d values, i.e. the caching client. While others return the values wrapped in a simple Inner type which is just a stack value.

Every container must implement Deref for the type it wraps, so for read-only operations the container can be used as if it were T. For mutable access see Self::into_inner.

Required Methods§

source

fn into_inner(self) -> T

All containers are capable of returning the value they wrap

However, the runtime performance of this varies by client type. For crate::Client, this operation is essentially free, however for the caching client, this results in a clone of the value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§