pub struct ValidatedXml(/* private fields */);Expand description
A cheap-to-clone, validated XML document retaining the exact original bytes.
Implementations§
Source§impl ValidatedXml
impl ValidatedXml
Sourcepub fn new(bytes: impl Into<Arc<[u8]>>) -> Result<Self, Error>
pub fn new(bytes: impl Into<Arc<[u8]>>) -> Result<Self, Error>
Validates and owns XML bytes under the default untrusted-input policy.
§Errors
Returns an error when the bytes violate the default XML safety or well-formedness contract.
Sourcepub fn with_policy(
bytes: impl Into<Arc<[u8]>>,
policy: XmlSafetyPolicy,
) -> Result<Self, Error>
pub fn with_policy( bytes: impl Into<Arc<[u8]>>, policy: XmlSafetyPolicy, ) -> Result<Self, Error>
Validates and owns XML bytes under policy.
§Errors
Returns an error when policy is invalid or the bytes violate a configured safety or
well-formedness rule.
Sourcepub fn from_reader<R: Read>(reader: R) -> Result<Self, Error>
pub fn from_reader<R: Read>(reader: R) -> Result<Self, Error>
Reads, validates, and owns XML under the default untrusted-input policy.
§Errors
Returns an error when reading fails or the input violates the default XML safety or well-formedness contract.
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn document(&self) -> &OwnedDocument
Trait Implementations§
Source§impl Clone for ValidatedXml
impl Clone for ValidatedXml
Source§fn clone(&self) -> ValidatedXml
fn clone(&self) -> ValidatedXml
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ValidatedXml
impl RefUnwindSafe for ValidatedXml
impl Send for ValidatedXml
impl Sync for ValidatedXml
impl Unpin for ValidatedXml
impl UnwindSafe for ValidatedXml
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
Mutably borrows from an owned value. Read more