Skip to main content

Array

Struct Array 

Source
pub struct Array<Identifier = String> {
    pub name: String,
    pub contents: Vec<Literal<Identifier>>,
    pub ann: Vec<Annotation<Identifier>>,
    pub defined: bool,
    pub introduced: bool,
}
Expand description

A definition of a named array literal in FlatZinc

FlatZinc Arrays are a simple (one-dimensional) sequence of Literals. These values are stored as the Array::contents member. Additional information, in the form of Annotations, from the MiniZinc model is stored in Array::ann when present. When Array::defined is set to true, then

Fields§

§name: String

The optional public name of the array literal.

This is None for arrays inlined within constraints.

§contents: Vec<Literal<Identifier>>

The values stored within the array literal

§ann: Vec<Annotation<Identifier>>

List of annotations

§defined: bool

This field is set to true when there is a constraint that has been marked as defining this array.

§introduced: bool

This field is set to true when the array has been introduced by the MiniZinc compiler, rather than being explicitly defined at the top-level of the MiniZinc model.

Implementations§

Source§

impl<Identifier> Array<Identifier>

Source

pub fn cloned_key(self: &Arc<Self>) -> ArcKey<Self>

Clones this array reference into an ArcKey.

This is useful when storing arrays in collections such as HashMap, HashSet, and BTreeMap, where the key should identify the specific parsed array object rather than its contents or name.

This method clones the Arc reference count and keeps the original array reference usable by the caller.

The resulting key uses the allocation / pointer identity of this Arc. Two arrays with the same name and equal contents will therefore compare as different keys if they are stored in different allocations.

During FlatZinc parsing and deserialization, this crate guarantees that identical top-level arrays are allocated only once. In those cases, ArcKey is a good fit for keying collections by the canonical parsed array object.

Trait Implementations§

Source§

impl<Identifier: Clone> Clone for Array<Identifier>

Source§

fn clone(&self) -> Array<Identifier>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Identifier: Debug> Debug for Array<Identifier>

Source§

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

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

impl<Identifier: PartialEq> PartialEq for Array<Identifier>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<Identifier> Serialize for Array<Identifier>
where Identifier: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<Identifier> StructuralPartialEq for Array<Identifier>

Auto Trait Implementations§

§

impl<Identifier> Freeze for Array<Identifier>

§

impl<Identifier> RefUnwindSafe for Array<Identifier>
where Identifier: RefUnwindSafe,

§

impl<Identifier> Send for Array<Identifier>
where Identifier: Send + Sync,

§

impl<Identifier> Sync for Array<Identifier>
where Identifier: Sync + Send,

§

impl<Identifier> Unpin for Array<Identifier>
where Identifier: Unpin,

§

impl<Identifier> UnsafeUnpin for Array<Identifier>

§

impl<Identifier> UnwindSafe for Array<Identifier>
where Identifier: UnwindSafe + RefUnwindSafe,

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, 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.