Struct Array

Source
pub struct Array<'ctx> { /* private fields */ }
Expand description

Ast node representing an array value. An array in Z3 is a mapping from indices to values.

Implementations§

Source§

impl<'ctx> Array<'ctx>

Source

pub fn new_const<S: Into<Symbol>>( ctx: &'ctx Context, name: S, domain: &Sort<'ctx>, range: &Sort<'ctx>, ) -> Array<'ctx>

Create an Array which maps from indices of the domain Sort to values of the range Sort.

All values in the Array will be unconstrained.

Source

pub fn fresh_const( ctx: &'ctx Context, prefix: &str, domain: &Sort<'ctx>, range: &Sort<'ctx>, ) -> Array<'ctx>

Source

pub fn const_array<A>( ctx: &'ctx Context, domain: &Sort<'ctx>, val: &A, ) -> Array<'ctx>
where A: Ast<'ctx>,

Create a “constant array”, that is, an Array initialized so that all of the indices in the domain map to the given value val

Source

pub fn select<A>(&self, index: &A) -> Dynamic<'ctx>
where A: Ast<'ctx>,

Get the value at a given index in the array.

Note that the index must be of the array’s domain sort. The return type will be of the array’s range sort.

Source

pub fn store<A1, A2>(&self, index: &A1, value: &A2) -> Self
where A1: Ast<'ctx>, A2: Ast<'ctx>,

Update the value at a given index in the array.

Note that the index must be of the array’s domain sort, and the value must be of the array’s range sort.

Trait Implementations§

Source§

impl<'ctx> Ast<'ctx> for Array<'ctx>

Source§

unsafe fn wrap(ctx: &'ctx Context, ast: Z3_ast) -> Self

Wrap a raw Z3_ast. Read more
Source§

fn get_ctx(&self) -> &'ctx Context

Source§

fn get_z3_ast(&self) -> Z3_ast

Source§

fn _eq(&self, other: &Self) -> Bool<'ctx>
where Self: Sized,

Compare this Ast with another Ast, and get a Bool representing the result. Read more
Source§

fn _safe_eq(&self, other: &Self) -> Result<Bool<'ctx>, SortDiffers<'ctx>>
where Self: Sized,

Compare this Ast with another Ast, and get a Result. Errors if the sort does not match for the two values.
Source§

fn distinct(ctx: &'ctx Context, values: &[&Self]) -> Bool<'ctx>
where Self: Sized,

Compare this Ast with a list of other Asts, and get a Bool which is true only if all arguments (including Self) are pairwise distinct. Read more
Source§

fn get_sort(&self) -> Sort<'ctx>

Get the Sort of the Ast.
Source§

fn simplify(&self) -> Self
where Self: Sized,

Simplify the Ast. Returns a new Ast which is equivalent, but simplified using algebraic simplification rules, such as constant propagation.
Source§

fn substitute<T: Ast<'ctx>>(&self, substitutions: &[(&T, &T)]) -> Self
where Self: Sized,

Performs substitution on the Ast. The slice substitutions contains a list of pairs with a “from” Ast that will be substituted by a “to” Ast.
Source§

fn num_children(&self) -> usize

Return the number of children of this Ast. Read more
Source§

fn nth_child(&self, idx: usize) -> Option<Dynamic<'ctx>>

Return the nth child of this Ast. Read more
Source§

fn children(&self) -> Vec<Dynamic<'ctx>>

Return the children of this node as a Vec<Dynamic>.
Source§

fn kind(&self) -> AstKind

Return the AstKind for this Ast.
Source§

fn is_app(&self) -> bool

Return true if this is a Z3 function application. Read more
Source§

fn is_const(&self) -> bool

Return true if this is a Z3 constant. Read more
Source§

fn decl(&self) -> FuncDecl<'ctx>

Return the FuncDecl of the Ast. Read more
Source§

fn safe_decl(&self) -> Result<FuncDecl<'ctx>, IsNotApp>

Source§

fn translate<'src_ctx>(&'src_ctx self, dest: &'ctx Context) -> Self
where Self: Sized,

Source§

impl<'ctx> Clone for Array<'ctx>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'ctx> Debug for Array<'ctx>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'ctx> Display for Array<'ctx>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'ctx> Drop for Array<'ctx>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'ctx> From<&Array<'ctx>> for Dynamic<'ctx>

Source§

fn from(ast: &Array<'ctx>) -> Self

Converts to this type from the input type.
Source§

impl<'ctx> From<Array<'ctx>> for Z3_ast

Source§

fn from(ast: Array<'ctx>) -> Self

Converts to this type from the input type.
Source§

impl<'ctx> From<Array<'ctx>> for Dynamic<'ctx>

Source§

fn from(ast: Array<'ctx>) -> Self

Converts to this type from the input type.
Source§

impl<'ctx> Hash for Array<'ctx>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'ctx> PartialEq for Array<'ctx>

Source§

fn eq(&self, other: &Array<'ctx>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'ctx> TryFrom<Dynamic<'ctx>> for Array<'ctx>

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(ast: Dynamic<'ctx>) -> Result<Self, String>

Performs the conversion.
Source§

impl<'ctx> Eq for Array<'ctx>

Auto Trait Implementations§

§

impl<'ctx> Freeze for Array<'ctx>

§

impl<'ctx> RefUnwindSafe for Array<'ctx>

§

impl<'ctx> !Send for Array<'ctx>

§

impl<'ctx> !Sync for Array<'ctx>

§

impl<'ctx> Unpin for Array<'ctx>

§

impl<'ctx> UnwindSafe for Array<'ctx>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.