keep

Function keep 

Source
pub fn keep<T>(o: T) -> Keep<T>
where T: ToOwning<Owning = T>,
Expand description

Constructs a Keep, assisting with type inference.

This function takes an object o : T such that T::Owning = T, and gives you back a Keep<T>. It is most useful when you have a T that implements ToOwning<Owning=T> but not Clone, and you need to wrap it in something that will give you a Clone implementation.

You should not use this function in the constructor of a type that is generic over Idempotent<T> and give it a T::Owning, because that will result in a Keep<T::Owning> when what you want is a Keep<T>. In this context you should use Keep’s primitive constructor instead.