Struct concrete_core::crypto::encoding::CleartextList [−][src]
pub struct CleartextList<Cont> { /* fields omitted */ }
Expand description
A list of clear, non-encoded, values.
Implementations
Allocates a new list of cleartexts.
Example
use concrete_core::crypto::{CleartextCount, encoding::*}; let clear_list = CleartextList::allocate(1 as u8, CleartextCount(100)); assert_eq!(clear_list.count(), CleartextCount(100));
Creates a cleartext list from a container of values.
Example
use concrete_core::crypto::{CleartextCount, encoding::CleartextList}; let clear_list = CleartextList::from_container(vec![1 as u8; 100]); assert_eq!(clear_list.count(), CleartextCount(100));
Returns the number of elements in the list.
Example
use concrete_core::crypto::{CleartextCount, encoding::CleartextList}; let clear_list = CleartextList::from_container(vec![1 as u8; 100]); assert_eq!(clear_list.count(), CleartextCount(100));
pub fn cleartext_iter(
&self
) -> impl Iterator<Item = &Cleartext<<Self as AsRefTensor>::Element>> where
Self: AsRefTensor,
<Self as AsRefTensor>::Element: Numeric,
pub fn cleartext_iter(
&self
) -> impl Iterator<Item = &Cleartext<<Self as AsRefTensor>::Element>> where
Self: AsRefTensor,
<Self as AsRefTensor>::Element: Numeric,
Creates an iterator over borrowed cleartexts.
Example
use concrete_core::crypto::{CleartextCount, encoding::CleartextList}; let clear_list = CleartextList::from_container(vec![1 as u8; 100]); clear_list.cleartext_iter() .for_each(|a| assert_eq!(a.0, 1)); assert_eq!(clear_list.cleartext_iter().count(), 100);
pub fn cleartext_iter_mut(
&mut self
) -> impl Iterator<Item = &mut Cleartext<<Self as AsMutTensor>::Element>> where
Self: AsMutTensor,
<Self as AsMutTensor>::Element: Numeric,
pub fn cleartext_iter_mut(
&mut self
) -> impl Iterator<Item = &mut Cleartext<<Self as AsMutTensor>::Element>> where
Self: AsMutTensor,
<Self as AsMutTensor>::Element: Numeric,
Creates an iterator over mutably borrowed cleartexts.
Example
use concrete_core::crypto::{CleartextCount, encoding::{CleartextList, Cleartext}}; let mut clear_list = CleartextList::from_container(vec![1 as u8; 100]); clear_list.cleartext_iter_mut() .for_each(|a| *a = Cleartext(2)); clear_list.cleartext_iter() .for_each(|a| assert_eq!(a.0, 2)); assert_eq!(clear_list.cleartext_iter_mut().count(), 100);
pub fn sublist_iter(
&self,
sub_len: CleartextCount
) -> impl Iterator<Item = CleartextList<&[<Self as AsRefTensor>::Element]>> where
Self: AsRefTensor,
pub fn sublist_iter(
&self,
sub_len: CleartextCount
) -> impl Iterator<Item = CleartextList<&[<Self as AsRefTensor>::Element]>> where
Self: AsRefTensor,
Creates an iterator over borrowed sub-lists.
Example
use concrete_core::crypto::{CleartextCount, encoding::CleartextList}; let clear_list = CleartextList::from_container(vec![1 as u8; 100]); clear_list.sublist_iter(CleartextCount(10)) .for_each(|a| assert_eq!(a.count(), CleartextCount(10))); assert_eq!(clear_list.sublist_iter(CleartextCount(10)).count(), 10);
pub fn sublist_iter_mut(
&mut self,
sub_len: CleartextCount
) -> impl Iterator<Item = CleartextList<&mut [<Self as AsRefTensor>::Element]>> where
Self: AsMutTensor,
pub fn sublist_iter_mut(
&mut self,
sub_len: CleartextCount
) -> impl Iterator<Item = CleartextList<&mut [<Self as AsRefTensor>::Element]>> where
Self: AsMutTensor,
Creates an iterator over mutably borrowed sub-lists.
#Example
use concrete_core::crypto::{CleartextCount, encoding::{Cleartext, CleartextList}}; let mut clear_list = CleartextList::from_container(vec![1 as u8; 100]); clear_list.sublist_iter_mut(CleartextCount(10)) .for_each(|mut a| a.cleartext_iter_mut().for_each(|b| *b = Cleartext(3))); clear_list.cleartext_iter() .for_each(|a| assert_eq!(*a, Cleartext(3))); assert_eq!(clear_list.sublist_iter_mut(CleartextCount(10)).count(), 10);
Trait Implementations
type Element = Element
type Element = Element
The element type.
Returns a mutable reference to the enclosed tensor.
type Element = Element
type Element = Element
The element type.
Returns a mutable reference to the enclosed tensor.
type Element = Element
type Element = Element
The element type.
type Container = AlignedVec<Element>
type Container = AlignedVec<Element>
The container used by the tensor.
Returns a mutable reference to the enclosed tensor.
type Element = Element
type Element = Element
The element type.
type Container = &'a mut [Element]
type Container = &'a mut [Element]
The container used by the tensor.
Returns a mutable reference to the enclosed tensor.
type Element = Element
type Element = Element
The element type of the collection container.
type Container = AlignedVec<Element>
type Container = AlignedVec<Element>
The type of the collection container.
Consumes self
and returns an owned tensor.
type Element = Element
type Element = Element
The element type of the collection container.
type Container = &'a [Element]
type Container = &'a [Element]
The type of the collection container.
Consumes self
and returns an owned tensor.
type Element = Element
type Element = Element
The element type of the collection container.
type Container = &'a mut [Element]
type Container = &'a mut [Element]
The type of the collection container.
Consumes self
and returns an owned tensor.
Auto Trait Implementations
impl<Cont> RefUnwindSafe for CleartextList<Cont> where
Cont: RefUnwindSafe,
impl<Cont> Send for CleartextList<Cont> where
Cont: Send,
impl<Cont> Sync for CleartextList<Cont> where
Cont: Sync,
impl<Cont> Unpin for CleartextList<Cont> where
Cont: Unpin,
impl<Cont> UnwindSafe for CleartextList<Cont> where
Cont: UnwindSafe,