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));

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);

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);

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);

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

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.