Struct rsvg::xml::attributes::Attributes
source · pub struct Attributes {
attrs: Box<[(QualName, DefaultAtom)]>,
id_idx: Option<u16>,
class_idx: Option<u16>,
}
Expand description
Iterable wrapper for libxml2’s representation of attribute/value.
See the new_from_xml2_attributes
function for information.
Fields§
§attrs: Box<[(QualName, DefaultAtom)]>
§id_idx: Option<u16>
§class_idx: Option<u16>
Implementations§
source§impl Attributes
impl Attributes
sourcepub unsafe fn new_from_xml2_attributes(
n_attributes: usize,
attrs: *const *const c_char,
) -> Result<Attributes, LoadingError>
pub unsafe fn new_from_xml2_attributes( n_attributes: usize, attrs: *const *const c_char, ) -> Result<Attributes, LoadingError>
Creates an iterable Attributes
from the C array of borrowed C strings.
With libxml2’s SAX parser, the caller’s startElementNsSAX2Func
callback gets passed a xmlChar **
for attributes, which
comes in groups of (localname/prefix/URI/value_start/value_end).
In those, localname/prefix/URI are NUL-terminated strings;
value_start and value_end point to the start-inclusive and
end-exclusive bytes in the attribute’s value.
§Safety
This function is unsafe because the caller must guarantee the following:
-
attrs
is a valid pointer, with (n_attributes * 5) elements. -
All strings are valid UTF-8.
sourcepub fn iter(&self) -> AttributesIter<'_> ⓘ
pub fn iter(&self) -> AttributesIter<'_> ⓘ
Creates an iterator that yields (QualName, &'a str)
tuples.
pub fn get_id(&self) -> Option<&str>
pub fn get_class(&self) -> Option<&str>
pub fn clear_class(&mut self)
Trait Implementations§
source§impl Clone for Attributes
impl Clone for Attributes
source§fn clone(&self) -> Attributes
fn clone(&self) -> Attributes
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for Attributes
impl RefUnwindSafe for Attributes
impl Send for Attributes
impl Sync for Attributes
impl Unpin for Attributes
impl UnwindSafe for Attributes
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.