arcis 0.12.0

A standard library of types and functions for writing MPC circuits with the Arcis framework.
Documentation
//! Methods on [`Cell`] accepted by the arcis interpreter.
//!
//! [`Cell`] here is a documentation-only redefinition of
//! [`std::cell::Cell`] — same shape, but with bodies that panic, since the
//! arcis interpreter intercepts the real method before they run.

const STUB_MSG: &str = "arcis::std::cell is documentation-only; \
    inside `#[encrypted]` code the interpreter intercepts the real method before this stub runs.";

/// Documentation of methods on [`Cell<T>`](std::cell::Cell) accepted by the
/// arcis interpreter. Mirrors [`std::cell::Cell`]'s shape.
pub struct Cell<T> {
    _phantom: ::core::marker::PhantomData<T>,
}

impl<T> Cell<T> {
    /// Constructs a new `Cell<T>`.
    pub fn new(value: T) -> Cell<T> {
        unimplemented!("{STUB_MSG}")
    }

    /// Reinterprets a `&mut T` as a `&Cell<T>`.
    pub fn from_mut(t: &mut T) -> &Cell<T> {
        unimplemented!("{STUB_MSG}")
    }

    /// Sets the contained value.
    pub fn set(&self, val: T) {
        unimplemented!("{STUB_MSG}")
    }

    /// Swaps the contents of two cells.
    pub fn swap(&self, other: &Cell<T>) {
        unimplemented!("{STUB_MSG}")
    }

    /// Updates the contained value by applying `f`.
    pub fn update(&self, f: impl FnOnce(T) -> T)
    where
        T: ::core::marker::Copy,
    {
        unimplemented!("{STUB_MSG}")
    }

    /// Replaces the contained value with `val`, returning the old value.
    pub fn replace(&self, val: T) -> T {
        unimplemented!("{STUB_MSG}")
    }

    /// Unwraps the contained value.
    pub fn into_inner(self) -> T {
        unimplemented!("{STUB_MSG}")
    }

    /// Returns a copy of the contained value.
    pub fn get(&self) -> T
    where
        T: ::core::marker::Copy,
    {
        unimplemented!("{STUB_MSG}")
    }

    /// Returns a mutable reference to the contained value.
    pub fn get_mut(&mut self) -> &mut T {
        unimplemented!("{STUB_MSG}")
    }
}