arcis 0.13.1

A standard library of types and functions for writing MPC circuits with the Arcis framework.
Documentation
//! Formatting traits accepted by the arcis interpreter.
//!
//! This module's traits are documentation-only handles: they exist so rustdoc
//! renders a page per trait, with an auto-generated implementors list showing
//! which types the arcis interpreter recognizes the trait on.
//!
//! They are never imported by user code.

/// `Debug` formatting recognized by the arcis interpreter.
///
/// # Implementing
///
/// User types gain `Debug` via [`#[derive(Debug)]`](https://doc.rust-lang.org/std/fmt/trait.Debug.html#derivable).
/// A hand-written `impl Debug for MyType` is **not** accepted — the
/// interpreter's forbidden-trait list rejects it.
///
/// # Calling
///
/// `Debug::fmt` is **not** callable from `#[encrypted]` code. The supported
/// surface is the formatting macros — [`print!`], [`println!`], [`eprint!`],
/// [`eprintln!`], and the [`debug_assert!`] / [`debug_assert_eq!`] /
/// [`debug_assert_ne!`] family — using the `{:?}` (or `{:#?}`) specifier:
///
/// ```ignore
/// println!("{:?}", x);
/// debug_assert_eq!(a, b);
/// ```
///
/// On the MPC side these macros expand to no-ops — printing and runtime
/// `debug_assert*!` checks have no observable effect during secure execution.
/// They are still useful for **local** debugging: a `#[test]` outside
/// `#[encrypted]` code can call into the same logic and execute the
/// `print!`/`debug_assert*!` calls normally, so you can stick them inside
/// `#[encrypted]` blocks and read the output / catch invariant violations
/// without changing the circuit.
///
/// # Implementors
///
/// The impl list below shows the types the interpreter recognizes as
/// debug-formattable. User types with `#[derive(Debug)]` are accepted at use
/// sites but do not appear in this list (their impls live in user code, not
/// in arcis).
pub trait Debug {}

// ---- Primitives ----

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

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

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

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

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

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

// ---- Composite ----

impl Debug for () {}

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

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

// ---- References ----

impl<T: Debug + ?Sized> Debug for &T {}
impl<T: Debug + ?Sized> Debug for &mut T {}

// ---- Wrappers ----

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

// ---- Ranges ----

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

// ---- Encrypted / packed data ----

impl<C: crate::Cipher + Debug, T: crate::ArcisType + Debug> Debug for crate::Enc<C, T> {}
impl<T: crate::ArcisType + Debug> Debug for crate::EncData<T> {}
impl<T: crate::ArcisType + Debug> Debug for crate::Pack<T> {}
impl Debug for crate::Shared {}
impl Debug for crate::Mxe {}