Skip to main content

Dup

Trait Dup 

Source
pub trait Dup: Clone {
    // Required method
    fn dup(&self) -> Self;
}
Expand description

Cheap duplication for prime-characteristic ring elements used in hot paths.

  • Copy scalars and packed fields use a trivial copy
  • non-Copy rings (e.g. symbolic expressions) should implement this with Clone::clone

It defaults to a trivial copy for types that are both Copy and Clone.

§Usage

It is recommended to rely on the Dup trait in downstream implementations for any type that is used in hot paths, such as trace cells in constraint evaluation for instance.

Required Methods§

Source

fn dup(&self) -> Self

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§

Source§

impl<T: Copy + Clone> Dup for T