Struct anitomy::Elements [−][src]
pub struct Elements { /* fields omitted */ }
Collection of Element
instances parsed from a filename, as a result of calling Anitomy.parse
.
Methods
impl Elements
[src]
impl Elements
pub fn is_empty<C: Into<Option<ElementCategory>>>(&self, category: C) -> bool
[src]
pub fn is_empty<C: Into<Option<ElementCategory>>>(&self, category: C) -> bool
Determines whether there are no elements of a given category.
Passing None
will check for any elements at all.
pub fn count<C: Into<Option<ElementCategory>>>(&self, category: C) -> usize
[src]
pub fn count<C: Into<Option<ElementCategory>>>(&self, category: C) -> usize
Counts the number of elements of a given category.
Passing None
will count all elements.
pub fn get(&self, category: ElementCategory) -> Option<&str>
[src]
pub fn get(&self, category: ElementCategory) -> Option<&str>
Gets the first element of a category if one exists.
pub fn get_all(&self, category: ElementCategory) -> Vec<&str>
[src]
pub fn get_all(&self, category: ElementCategory) -> Vec<&str>
Gets all elements of a category.
Methods from Deref<Target = Vec<Element>>
pub fn capacity(&self) -> usize
1.0.0[src]
pub fn capacity(&self) -> usize
Returns the number of elements the vector can hold without reallocating.
Examples
let vec: Vec<i32> = Vec::with_capacity(10); assert_eq!(vec.capacity(), 10);
pub fn as_slice(&self) -> &[T]
1.7.0[src]
pub fn as_slice(&self) -> &[T]
Extracts a slice containing the entire vector.
Equivalent to &s[..]
.
Examples
use std::io::{self, Write}; let buffer = vec![1, 2, 3, 5, 8]; io::sink().write(buffer.as_slice()).unwrap();
pub fn len(&self) -> usize
1.0.0[src]
pub fn len(&self) -> usize
Returns the number of elements in the vector, also referred to as its 'length'.
Examples
let a = vec![1, 2, 3]; assert_eq!(a.len(), 3);
pub fn is_empty(&self) -> bool
1.0.0[src]
pub fn is_empty(&self) -> bool
Returns true
if the vector contains no elements.
Examples
let mut v = Vec::new(); assert!(v.is_empty()); v.push(1); assert!(!v.is_empty());
Trait Implementations
impl Debug for Elements
[src]
impl Debug for Elements
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Elements
[src]
impl Clone for Elements
fn clone(&self) -> Elements
[src]
fn clone(&self) -> Elements
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Elements
[src]
impl PartialEq for Elements
fn eq(&self, other: &Elements) -> bool
[src]
fn eq(&self, other: &Elements) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Elements) -> bool
[src]
fn ne(&self, other: &Elements) -> bool
This method tests for !=
.
impl Eq for Elements
[src]
impl Eq for Elements
impl Deref for Elements
[src]
impl Deref for Elements