Skip to main content

IntoLive

Trait IntoLive 

Source
pub trait IntoLive {
    // Required method
    fn into_live(self) -> Arc<Live> ⓘ;
}
Expand description

What a projection is built over: something that can hand out the current context.

One trait so that the shared server passes the Live it watches with and every other caller — one-shot commands, benchmarks, the crate’s own tests — passes the Arc<Context> it already has and gets a pinned view without saying so.

// a projection takes either, and neither caller has to say which it holds
fn projection(over: impl IntoLive) -> u64 { over.into_live().generation() }
assert_eq!(projection(ctx), 0);
assert_eq!(projection(live), 0);

Required Methods§

Source

fn into_live(self) -> Arc<Live> ⓘ

The live view this value stands for.

// a plain context becomes a view that follows nothing and costs nothing
assert_eq!(ctx.into_live().generation(), 0);

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoLive for Arc<Context>

Source§

impl IntoLive for Arc<Live>

Implementors§