arcis 0.14.1

A standard library of types and functions for writing MPC circuits with the Arcis framework.
Documentation
//! Cloning trait accepted by the arcis interpreter.
//!
//! This trait is a documentation-only handle: it exists so rustdoc renders a
//! page with an auto-generated implementors list showing which types the
//! arcis interpreter recognizes the trait on.
//!
//! It is never imported by user code. Inside `#[encrypted]` code the
//! interpreter dispatches `.clone()` directly; you do not need to bring this
//! trait into scope.

/// `Clone` semantics accepted by the arcis interpreter.
///
/// # Implementing
///
/// User types gain `Clone` via [`#[derive(Clone)]`](https://doc.rust-lang.org/std/clone/trait.Clone.html#derivable).
/// A hand-written `impl Clone for MyType` is **not** accepted — the
/// interpreter's forbidden-trait list rejects it.
///
/// # Calling
///
/// Inside `#[encrypted]` code, the supported forms are:
///
/// * `a.clone()`.
/// * `<T as Clone>::clone(&a)`.
///
/// The unqualified trait form `Clone::clone(&a)` is not accepted: the
/// interpreter needs the receiver type to know which impl to dispatch to.
///
/// # Implementors
///
/// The impl list below shows the types the interpreter recognizes as
/// clonable. User types with `#[derive(Clone)]` are accepted at use sites but
/// do not appear in this list (their impls live in user code, not in arcis).
pub trait Clone {}

// ---- Primitives ----

impl Clone for crate::std::boolean::bool {}

impl Clone for crate::std::integer::u8 {}
impl Clone for crate::std::integer::u16 {}
impl Clone for crate::std::integer::u32 {}
impl Clone for crate::std::integer::u64 {}
impl Clone for crate::std::integer::u128 {}
impl Clone for crate::std::integer::usize {}

impl Clone for crate::std::integer::i8 {}
impl Clone for crate::std::integer::i16 {}
impl Clone for crate::std::integer::i32 {}
impl Clone for crate::std::integer::i64 {}
impl Clone for crate::std::integer::i128 {}
impl Clone for crate::std::integer::isize {}

impl Clone for crate::std::float::f32 {}
impl Clone for crate::std::float::f64 {}

// ---- Arcis built-in scalar types ----

impl Clone for crate::BaseField25519 {}
impl Clone for crate::ArcisX25519Pubkey {}

// ---- Composite ----

impl Clone for () {}

impl<T: Clone, const N: usize> Clone for [T; N] {}

impl<T1: Clone> Clone for (T1,) {}
impl<T1: Clone, T2: Clone> Clone for (T1, T2) {}
impl<T1: Clone, T2: Clone, T3: Clone> Clone for (T1, T2, T3) {}
impl<T1: Clone, T2: Clone, T3: Clone, T4: Clone> Clone for (T1, T2, T3, T4) {}
impl<T1: Clone, T2: Clone, T3: Clone, T4: Clone, T5: Clone> Clone for (T1, T2, T3, T4, T5) {}
impl<T1: Clone, T2: Clone, T3: Clone, T4: Clone, T5: Clone, T6: Clone> Clone
    for (T1, T2, T3, T4, T5, T6)
{
}
impl<T1: Clone, T2: Clone, T3: Clone, T4: Clone, T5: Clone, T6: Clone, T7: Clone> Clone
    for (T1, T2, T3, T4, T5, T6, T7)
{
}
impl<T1: Clone, T2: Clone, T3: Clone, T4: Clone, T5: Clone, T6: Clone, T7: Clone, T8: Clone> Clone
    for (T1, T2, T3, T4, T5, T6, T7, T8)
{
}
impl<
        T1: Clone,
        T2: Clone,
        T3: Clone,
        T4: Clone,
        T5: Clone,
        T6: Clone,
        T7: Clone,
        T8: Clone,
        T9: Clone,
    > Clone for (T1, T2, T3, T4, T5, T6, T7, T8, T9)
{
}
impl<
        T1: Clone,
        T2: Clone,
        T3: Clone,
        T4: Clone,
        T5: Clone,
        T6: Clone,
        T7: Clone,
        T8: Clone,
        T9: Clone,
        T10: Clone,
    > Clone for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
{
}
impl<
        T1: Clone,
        T2: Clone,
        T3: Clone,
        T4: Clone,
        T5: Clone,
        T6: Clone,
        T7: Clone,
        T8: Clone,
        T9: Clone,
        T10: Clone,
        T11: Clone,
    > Clone for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
{
}
impl<
        T1: Clone,
        T2: Clone,
        T3: Clone,
        T4: Clone,
        T5: Clone,
        T6: Clone,
        T7: Clone,
        T8: Clone,
        T9: Clone,
        T10: Clone,
        T11: Clone,
        T12: Clone,
    > Clone for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
{
}

// ---- References ----
//
// `&T` is `Clone` (it's `Copy`). `&mut T` is not `Clone`.

impl<T: ?Sized> Clone for &T {}

// ---- Wrappers ----

impl<T: Clone> Clone for crate::std::option::Option<T> {}
impl<T: Clone + ?Sized> Clone for crate::std::boxed::Box<T> {}
impl<T: Copy> Clone for crate::std::cell::Cell<T> {}

// ---- Ranges ----

impl<Idx: Clone> Clone for crate::std::ops::Range<Idx> {}
impl<Idx: Clone> Clone for crate::std::ops::RangeInclusive<Idx> {}
impl<Idx: Clone> Clone for crate::std::ops::RangeFrom<Idx> {}
impl<Idx: Clone> Clone for crate::std::ops::RangeTo<Idx> {}
impl<Idx: Clone> Clone for crate::std::ops::RangeToInclusive<Idx> {}
impl Clone for crate::std::ops::RangeFull {}

// ---- Encrypted / packed data ----
//
// Only `EncData<T>` derives `Clone` in real Rust. `Enc<C, T>`, `Pack<T>`,
// `Shared`, and `Mxe` don't, so they are deliberately absent here.

impl<T: crate::ArcisType + Clone> Clone for crate::EncData<T> {}