Element

Struct Element 

Source
pub struct Element(/* private fields */);
Expand description

An arxml element

This is a wrapper type which provides all the necessary manipulation functions.

Implementations§

Source§

impl Element

Source

pub fn parent(&self) -> Result<Option<Element>, AutosarDataError>

Get the parent element of the current element

Returns None if the current element is the root, or if it has been deleted from the element hierarchy

§Example
if let Some(parent) = element.parent()? {
    // ...
}
§Errors
Source

pub fn named_parent(&self) -> Result<Option<Element>, AutosarDataError>

Get the next named parent (or grandparent, etc) of the current element

This function steps through the hierarchy until an identifiable element is found. It never returns the current element, even if the current element is identifiable.

The function returns a suitable element if one is found, or None if the root is reached.

§Example
let el_elements = el_arpackage.create_sub_element(ElementName::Elements)?;
let el_system = el_elements.create_named_sub_element(ElementName::System, "Sys")?;
let named_parent = el_elements.named_parent()?.unwrap();
let named_parent2 = el_system.named_parent()?.unwrap();
assert_eq!(named_parent, el_arpackage);
assert_eq!(named_parent2, el_arpackage);
§Errors
Source

pub fn element_name(&self) -> ElementName

Get the ElementName of the element

§Example
let element = model.root_element();
let element_name = element.element_name();
assert_eq!(element_name, ElementName::Autosar);
Source

pub fn element_type(&self) -> ElementType

Get the ElementType of the element

The ElementType is needed in order to call methods from the autosar-data-specification crate

§Example
let element_type = element.element_type();
Source

pub fn item_name(&self) -> Option<String>

Get the name of an identifiable element

An identifiable element has a <SHORT-NAME> sub element and can be referenced using an autosar path.

If the element is not identifiable, this function returns None

§Example
if let Some(item_name) = element.item_name() {
    // ...
}
Source

pub fn set_item_name(&self, new_name: &str) -> Result<(), AutosarDataError>

Set the item name of this element

This operation will update all references pointing to the element or its sub-elements so that they remain valid.

§Example
element.set_item_name("NewName");
§Note

In order to rename an element without updating any references, do this instead:

if let Some(short_name) = element.get_sub_element(ElementName::ShortName) {
    short_name.set_character_data("the_new_name");
}
§Errors
Source

pub fn is_identifiable(&self) -> bool

Returns true if the element is identifiable

In order to be identifiable, the specification must require a SHORT-NAME sub-element and the SHORT-NAME must actually be present.

§Example
if element.is_identifiable() {
    // ...
}
Source

pub fn is_reference(&self) -> bool

Returns true if the element should contain a reference to another element

The function does not check if the reference is valid

§Example
if element.is_reference() {
    // ex: element.set_reference_target(...)
}
Source

pub fn path(&self) -> Result<String, AutosarDataError>

Get the Autosar path of an identifiable element

§Example
let path = element.path()?;
§Errors
Source

pub fn model(&self) -> Result<AutosarModel, AutosarDataError>

Get a reference to the AutosarModel containing the current element

§Example
let file = element.model()?;
§Errors
Source

pub fn content_type(&self) -> ContentType

Get the ContentType of the current element

§Example
if element.content_type() == ContentType::CharacterData {
    // ...
}
Source

pub fn create_sub_element( &self, element_name: ElementName, ) -> Result<Element, AutosarDataError>

Create a sub element at a suitable insertion position

The given ElementName must be allowed on a sub element in this element, taking into account any sub elements that may already exist. It is not possible to create named sub elements with this function; use create_named_sub_element() for that instead.

§Example
let element = model.root_element().create_sub_element(ElementName::ArPackages)?;
§Errors
Source

pub fn create_sub_element_at( &self, element_name: ElementName, position: usize, ) -> Result<Element, AutosarDataError>

Create a sub element at the specified insertion position

The given ElementName must be allowed on a sub element in this element, taking into account any sub elements that may already exist. It is not possible to create named sub elements with this function; use create_named_sub_element_at() for that instead.

The specified insertion position will be compared to the range of valid insertion positions; if it falls outside that range then the function fails.

§Example
let element = model.root_element().create_sub_element_at(ElementName::ArPackages, 0)?;
§Errors
Source

pub fn create_named_sub_element( &self, element_name: ElementName, item_name: &str, ) -> Result<Element, AutosarDataError>

Create a named/identifiable sub element at a suitable insertion position

The given ElementName must be allowed on a sub element in this element, taking into account any sub elements that may already exist.

This method can only be used to create identifiable sub elements.

§Example
let pkgs_element = model.root_element().create_sub_element(ElementName::ArPackages)?;
let element = pkgs_element.create_named_sub_element(ElementName::ArPackage, "Package")?;
§Errors
Source

pub fn create_named_sub_element_at( &self, element_name: ElementName, item_name: &str, position: usize, ) -> Result<Element, AutosarDataError>

Create a named/identifiable sub element at the specified insertion position

The given ElementName must be allowed on a sub element in this element, taking into account any sub elements that may already exist. The specified insertion position will be compared to the range of valid insertion positions; if it falls outside that range then the function fails.

This method can only be used to create identifiable sub elements.

§Example
let pkgs_element = model.root_element().create_sub_element(ElementName::ArPackages)?;
let element = pkgs_element.create_named_sub_element_at(ElementName::ArPackage, "Package", 0)?;
§Errors
Source

pub fn create_copied_sub_element( &self, other: &Element, ) -> Result<Element, AutosarDataError>

Create a deep copy of the given element and insert it as a sub-element

The other element must be a permissible sub-element in this element and not conflict with any existing sub element. The other element can originate from any loaded AutosarModel, it does not have to originate from the same model or file as the current element.

The AutosarVersion of the other element might differ from the version of the current file; in this case a partial copy will be performed that omits all incompatible elements.

If the copied element is identifiable, then the item name might be extended with a numerical suffix, if one is required in order to make the name unique. For example: An identifiable element “Foo” already exists at the same path; the copied identifiable element will be renamed to “Foo_1”.

If the copied element or the hierarchy of elements under it contain any references, then these will need to be adjusted manually after copying.

§Example
let other_element = model.get_element_by_path("/Package/Path").unwrap();
let element = base.create_copied_sub_element(&other_element)?;
§Errors
Source

pub fn create_copied_sub_element_at( &self, other: &Element, position: usize, ) -> Result<Element, AutosarDataError>

Create a deep copy of the given element and insert it as a sub-element at the given position

The other element must be a permissible sub-element in this element and not conflict with any existing sub element. The other element can originate from any loaded AutosarModel, it does not have to originate from the same model or file as the current element.

The AutosarVersion of the other element might differ from the version of the current file; in this case a partial copy will be performed that omits all incompatible elements.

If the copied element is identifiable, then the item name might be extended with a numerical suffix, if one is required in order to make the name unique. For example: An identifiable element “Foo” already exists at the same path; the copied identifiable element will be renamed to “Foo_1”.

If the copied element or the hierarchy of elements under it contain any references, then these will need to be adjusted manually after copying.

§Example
let other_element = model.get_element_by_path("/Package/Path").unwrap();
let element = base.create_copied_sub_element_at(&other_element, 0)?;
§Errors
Source

pub fn move_element_here( &self, move_element: &Element, ) -> Result<Element, AutosarDataError>

Take an element from it’s current location and place it in this element as a sub element

The moved element can be taken from anywhere - even from a different arxml document that is not part of the same AutosarModel

Restrictions:

  1. The element must have a compatible element type. If it could not have been created here, then it can’t be moved either.
  2. The origin document of the element must have exactly the same AutosarVersion as the destination.
§Example
let other_element = model.get_element_by_path("/Package/Path").unwrap();
let element = base.move_element_here(&other_element)?;
§Errors
Source

pub fn move_element_here_at( &self, move_element: &Element, position: usize, ) -> Result<Element, AutosarDataError>

Take an element from it’s current location and place it at the given position in this element as a sub element

The moved element can be taken from anywhere - even from a different arxml document that is not part of the same AutosarModel

Restrictions:

  1. The element must have a compatible element type. If it could not have been created here, then it can’t be moved either.
  2. The origin document of the element must have exactly the same AutosarVersion as the destination.
§Example
let other_element = model.get_element_by_path("/Package/Path").unwrap();
let element = base.move_element_here_at(&other_element, 0)?;
§Errors
Source

pub fn remove_sub_element( &self, sub_element: Element, ) -> Result<(), AutosarDataError>

Remove the sub element sub_element

The sub_element will be unlinked from the hierarchy of elements. All of the sub-sub-elements nested under the removed element will also be recusively removed.

Since all elements are reference counted, they might not be deallocated immediately, however they do become invalid and unusable immediately.

§Example
let packages = model.root_element().create_sub_element(ElementName::ArPackages)?;
model.root_element().remove_sub_element(packages)?;
§Errors
Source

pub fn remove_sub_element_kind( &self, element_name: ElementName, ) -> Result<(), AutosarDataError>

Remove a sub element identified by an ElementName

If multiple sub elements with the same ElementName exist, only the first one will be removed.

A sub element with the given ElementName will be unlinked from the hierarchy of elements. All of the sub-sub-elements nested under the removed element will also be recusively removed.

This is a convenience function that is equivalent to calling get_sub_element() followed by remove_sub_element().

§Example
let packages = model.root_element().create_sub_element(ElementName::ArPackages)?;
model.root_element().remove_sub_element_kind(ElementName::ArPackages)?;
§Errors
Source

pub fn set_reference_target( &self, target: &Element, ) -> Result<(), AutosarDataError>

Set the reference target for the element to target

When the reference is updated, the DEST attribute is also updated to match the referenced element. The current element must be a reference element, otherwise the function fails.

§Example
let cluster_element = elements.create_named_sub_element(ElementName::CanCluster, "Cluster")?;
ref_element.set_reference_target(&cluster_element)?;
§Errors
Source

pub fn get_reference_target(&self) -> Result<Element, AutosarDataError>

Get the referenced element

This function will get the reference string from the character data of the element as well as the destination type from the DEST attribute. Then a lookup of the Autosar path is performed, and if an element is found at that path, then the type of the element is compared to the expected type.

The element is returned if it exists and its type is correct.

§Example
let cluster_element = elements.create_named_sub_element(ElementName::CanCluster, "Cluster")?;
ref_element.set_reference_target(&cluster_element)?;
let ref_target = ref_element.get_reference_target()?;
assert_eq!(cluster_element, ref_target);
§Errors
Source

pub fn set_character_data<T: Into<CharacterData>>( &self, value: T, ) -> Result<(), AutosarDataError>

Set the character data of this element

This method only applies to elements which contain character data, i.e. element.content_type == CharacterData or Mixed. On elements with mixed content this function will replace all current content with the single new CharacterData item.

§Example
element.set_character_data("value")?;
§Errors
Source

pub fn remove_character_data(&self) -> Result<(), AutosarDataError>

Remove the character data of this element

This method only applies to elements which contain character data, i.e. element.content_type == CharacterData

§Example
element.remove_character_data()?;
§Errors
Source

pub fn insert_character_content_item( &self, chardata: &str, position: usize, ) -> Result<(), AutosarDataError>

Insert a character data item into the content of this element

This method only applies to elements which contain mixed data, i.e. element.content_type() == Mixed. Use create_sub_element_at to add an element instead of a character data item

§Example
// mixed content elements are primarily used for documentation and description
let desc = element.create_sub_element(ElementName::Desc)?;
let l2 = desc.create_sub_element(ElementName::L2)?;
l2.insert_character_content_item("descriptive text", 0)?;
§Errors
Source

pub fn remove_character_content_item( &self, position: usize, ) -> Result<(), AutosarDataError>

Remove a character data item from the content of this element

This method only applies to elements which contain mixed data, i.e. element.content_type == Mixed

§Example
element.insert_character_content_item("descriptive text", 0)?;
element.remove_character_content_item(0)?;
§Errors
Source

pub fn content_item_count(&self) -> usize

returns the number of content items in this element

assert_eq!(pkg.content_item_count(), 1);
Source

pub fn character_data(&self) -> Option<CharacterData>

Get the character content of the element

This method only applies to elements which contain character data, i.e. element.content_type() == CharacterData

§Example
match element.character_data() {
    Some(CharacterData::String(stringval)) => {},
    Some(CharacterData::Enum(enumval)) => {},
    Some(CharacterData::UnsignedInteger(intval)) => {},
    Some(CharacterData::Float(floatval)) => {},
    None => {},
}
Source

pub fn content(&self) -> ElementContentIterator

Create an iterator over all of the content of this element

The iterator can return both sub elements and character data, wrapped as ElementContent::Element and ElementContent::CharacterData

This method is intended to be used with elements that contain mixed content.

§Example
for content_item in element.content() {
    match content_item {
        ElementContent::CharacterData(data) => {},
        ElementContent::Element(element) => {},
    }
}
Source

pub fn downgrade(&self) -> WeakElement

Create a weak reference to this element

A weak reference can be stored without preventing the element from being deallocated. The weak reference has to be upgraded in order to be used, which can fail if the element no longer exists.

See the documentation for Arc

§Example
let weak_element = element.downgrade();
Source

pub fn position(&self) -> Option<usize>

return the position of this element within the parent element

None may be returned if the element has been deleted, or for the root element (AUTOSAR) which has no parent. The returned position can be used with get_sub_element_at().

§Example
let el_pkg1 = el_ar_packages.create_named_sub_element(ElementName::ArPackage, "Pkg1").unwrap();
let el_pkg2 = el_ar_packages.create_named_sub_element(ElementName::ArPackage, "Pkg2").unwrap();
let el_pkg3 = el_ar_packages.create_named_sub_element(ElementName::ArPackage, "Pkg3").unwrap();
let position = el_pkg2.position().unwrap();
assert_eq!(position, 1);
assert_eq!(el_pkg2, el_ar_packages.get_sub_element_at(position).unwrap());
Source

pub fn sub_elements(&self) -> ElementsIterator

Create an iterator over all sub elements of this element

§Example
for sub_element in element.sub_elements() {
    // ...
}
Source

pub fn get_sub_element(&self, name: ElementName) -> Option<Element>

Get the sub element with the given element name

Returns None if no such element exists. if there are multiple sub elements with the requested name, then only the first is returned

§Example
let element = pkg.get_sub_element(ElementName::ShortName).unwrap();
assert_eq!(element.element_name(), ElementName::ShortName);
Source

pub fn get_sub_element_at(&self, position: usize) -> Option<Element>

Get the sub element at the given position.

Returns None if no such element exists.

§Example
let element = pkg.get_sub_element_at(0).unwrap();
assert_eq!(element.element_name(), ElementName::ShortName);
Source

pub fn get_or_create_sub_element( &self, name: ElementName, ) -> Result<Element, AutosarDataError>

Get or create a sub element

This is a shorthand for get_sub_element followed by create_cub_element if getting an existing element fails.

§Example
let element = model.root_element().get_or_create_sub_element(ElementName::ArPackages)?;
let element2 = model.root_element().get_or_create_sub_element(ElementName::ArPackages)?;
assert_eq!(element, element2);
§Errors
Source

pub fn get_or_create_named_sub_element( &self, element_name: ElementName, item_name: &str, ) -> Result<Element, AutosarDataError>

Get or create a named sub element

Checks if a matching subelement exists, and returns it if it does. If no matching subelement exists, tries to create one.

§Example
let ar_packages = model.root_element().get_or_create_sub_element(ElementName::ArPackages)?;
let pkg = ar_packages.get_or_create_named_sub_element(ElementName::ArPackage, "Pkg")?;
let pkg_2 = ar_packages.get_or_create_named_sub_element(ElementName::ArPackage, "Pkg")?;
assert_eq!(pkg, pkg_2);
§Errors
Source

pub fn elements_dfs(&self) -> ElementsDfsIterator

Create a depth first iterator over this element and all of its sub elements

Each step in the iteration returns the depth and an element. Due to the nature of a depth first search, the returned depth can remain the same, increase by one, or decrease by an arbitrary number in each step.

The dfs iterator will always return this element as the first item.

§Example
for (depth, elem) in element.elements_dfs() {
    // ...
}
Source

pub fn elements_dfs_with_max_depth( &self, max_depth: usize, ) -> ElementsDfsIterator

Create a depth first iterator over this element and all of its sub elements up to a maximum depth

Each step in the iteration returns the depth and an element. Due to the nature of a depth first search, the returned depth can remain the same, increase by one, or decrease by an arbitrary number in each step.

The dfs iterator will always return this element as the first item. A max_depth of 0 returns all child elements, regardless of depth (like elements_dfs does).

§Example
for (depth, elem) in element.elements_dfs_with_max_depth(1) {
    assert!(depth <= 1);
    // ...
}
Source

pub fn attributes(&self) -> AttributeIterator

Create an iterator over all the attributes in this element

§Example
for attribute in element.attributes() {
    println!("{} = {}", attribute.attrname, attribute.content);
}
Source

pub fn attribute_value(&self, attrname: AttributeName) -> Option<CharacterData>

Get the value of an attribute by name

§Example
let value = model.root_element().attribute_value(AttributeName::xsiSchemalocation);
Source

pub fn set_attribute<T: Into<CharacterData>>( &self, attrname: AttributeName, value: T, ) -> Result<(), AutosarDataError>

Set the value of a named attribute

If no attribute by that name exists, and the attribute is a valid attribute of the element, then the attribute will be created.

Returns Ok(()) if the attribute was set, otherwise the Err indicates why setting the attribute failed.

let result = element.set_attribute(AttributeName::S, CharacterData::String("1234-5678".to_string()));
§Errors
Source

pub fn set_attribute_string( &self, attrname: AttributeName, stringvalue: &str, ) -> Result<(), AutosarDataError>

Set the value of a named attribute from a string

The function tries to convert the string to the correct data type for the attribute

Returns Ok(()) if the attribute was set, otherwise the Err indicates why setting the attribute failed.

let result = element.set_attribute_string(AttributeName::T, "2022-01-31T13:59:59Z");
§Errors
Source

pub fn remove_attribute(&self, attrname: AttributeName) -> bool

Remove an attribute from the element

Returns true if the attribute existed and could be removed.

§Example
let result = model.root_element().remove_attribute(AttributeName::xsiSchemalocation);
// xsiSchemalocation exists in the AUTOSAR element, but it is mandatory and cannot be removed
assert_eq!(result, false);
Source

pub fn sort(&self)

Recursively sort all sub-elements of this element

All sub elements of the current element are sorted alphabetically. If the sub-elements are named, then the sorting is performed according to the item names, otherwise the serialized form of the sub-elements is used for sorting. Element attributes are not taken into account while sorting. The elements are sorted in place, and sorting cannot fail, so there is no return value.

§Example
element.sort();
Source

pub fn serialize(&self) -> String

Serialize the element and all of its content to a string

The serialized text generated for elements below the root element cannot be loaded, but it may be useful for display.

§Example
let text = element.serialize();
Source

pub fn list_valid_sub_elements(&self) -> Vec<ValidSubElementInfo>

List all sub_elements that are valid in the current element

The target use case is direct interaction with a user, e.g. through a selection dialog

§Return Value

A list of tuples consisting of ElementName of the potential sub element bool: is the sub element named bool: can this sub element be inserted considering the current content of the element

§Example
for ValidSubElementInfo{element_name, is_named, is_allowed} in element.list_valid_sub_elements() {
    // ...
}
Source

pub fn file_membership( &self, ) -> Result<(bool, HashSet<WeakArxmlFile>), AutosarDataError>

Return the set of files in which the current element is present

§Return Value

A tuple (bool, HashSet); if the bool value is true, then the file set is stored in this element, otherwise it is inherited from a parent element.

§Example
let (inherited, file_membership) = element.file_membership()?;
§Errors
Source

pub fn add_to_file(&self, file: &ArxmlFile) -> Result<(), AutosarDataError>

add the current element to the given file

In order to successfully cause the element to appear in the serialized file data, all parent elements of the current element will also be added if required.

If the model only has a single file then this function does nothing.

§Example
let file = model.create_file("test", AutosarVersion::Autosar_00050).unwrap();
element.add_to_file(&file);
§Errors
Source

pub fn remove_from_file(&self, file: &ArxmlFile) -> Result<(), AutosarDataError>

remove this element from a file

If the model consists of multiple files, then the set of files in which this element appears will be restricted. It may be required to also omit its parent(s), up to the next splittable point.

If the element is only present in single file then an attempt to delete it will be made instead. Deleting the element fails if the element is the root AUTOSAR element, or if it is a SHORT-NAME.

§Example
assert!(model.files().count() > 1);
element.remove_from_file(&file);
§Errors
Source

pub fn xml_path(&self) -> String

Return a path that includes non-identifiable elements by their xml names

This function cannot fail completely, it will always collect as much information as possible. It is intended for display in error messages.

Source

pub fn calc_element_insert_range( &self, element_name: ElementName, version: AutosarVersion, ) -> Result<(usize, usize), AutosarDataError>

Find the upper and lower bound on the insert position for a new sub element

If the sub element is allowed for this element given its current content, this function returns the lower and upper bound on the position the new sub element could have. If the sub element is not allowed, then an Err is returned instead.

The lower and upper bounds are inclusive: lower <= (element insert pos) <= upper. In many situations lower == upper, this means there is only a single valid position.

§Example
let (lbound, ubound) = model.root_element()
    .calc_element_insert_range(ElementName::ArPackages, AutosarVersion::LATEST)?;
model.root_element().create_sub_element_at(ElementName::ArPackages, lbound)?;
§Errors
Source

pub fn comment(&self) -> Option<String>

Return the comment attachd to the element (if any)

A comment directly preceding the opening tag is considered to be atached and is returned here.

In the arxml text:

    <!--element comment-->
    <ELEMENT> ...
§Example
let opt_comment = element.comment();
Source

pub fn set_comment(&self, opt_comment: Option<String>)

Set or delete the comment attached to the element

Set None to remove the comment.

If the new comment value contains “–”, then this is replaced with “__”, because “–” is forbidden inside XML comments.

§Example
element.set_comment(Some(string));
Source

pub fn min_version(&self) -> Result<AutosarVersion, AutosarDataError>

find the minumum version of all arxml files which contain this element

Typically this reduces to finding out which single file contains the element and returning this version.

§Example
let file1 = model.create_file("file1", AutosarVersion::LATEST).unwrap();
let file2 = model.create_file("file2", AutosarVersion::Autosar_4_3_0).unwrap();
let version = model.root_element().min_version().unwrap();
assert_eq!(version, AutosarVersion::Autosar_4_3_0);
§Errors

Trait Implementations§

Source§

impl Clone for Element

Source§

fn clone(&self) -> Element

Returns a duplicate 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 Debug for Element

Source§

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

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

impl Hash for Element

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 Ord for Element

Source§

fn cmp(&self, other: &Element) -> Ordering

compare the content of two elements

This function compares the content of two elements, returning a cmp::Ordering value. The purpose of this function is to allow sorting of elements based on their content.

The comparison is performed in the following order:

  1. Element name
  2. Index (if present)
  3. Item name (if present)
  4. Definition reference (if present)
  5. DEST attribute (if present)
  6. Content of the element
  7. Attributes of the element

If the comparison returns Ordering::Equal, then the two elements are identical, but this does not imply that they are the same object.

§Example
let ordering = element1.cmp(&element2);
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Element

Source§

fn eq(&self, other: &Self) -> 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 PartialOrd for Element

Source§

fn partial_cmp(&self, other: &Element) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for Element

Auto Trait Implementations§

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.