Skip to main content

PhoneXmlDocument

Trait PhoneXmlDocument 

Source
pub trait PhoneXmlDocument:
    Sealed
    + Sized
    + Serialize
    + DeserializeOwned {
    const ROOT: &'static [u8];
    const MAXIMUM_BYTES: usize;

    // Required method
    fn validate_document(&self) -> Result<(), PhoneXmlError>;

    // Provided methods
    fn parse_xml(document: &[u8]) -> Result<Self, PhoneXmlError> { ... }
    fn parse_xml_with_limit(
        document: &[u8],
        maximum_bytes: usize,
    ) -> Result<Self, PhoneXmlError> { ... }
    fn serialize_xml(&self) -> Result<String, PhoneXmlError> { ... }
    fn serialize_xml_with_limit(
        &self,
        maximum_bytes: usize,
    ) -> Result<String, PhoneXmlError> { ... }
}
Expand description

Common bounded parsing and serialization contract for a complete phone XML document.

The trait is sealed because every supported root has its own schema and validation policy. It centralizes the security boundary without allowing a downstream type to opt into parsing with a guessed root or size limit.

Required Associated Constants§

Source

const ROOT: &'static [u8]

Exact root element accepted for this document model.

Source

const MAXIMUM_BYTES: usize

Default maximum encoded document size, in bytes.

Required Methods§

Source

fn validate_document(&self) -> Result<(), PhoneXmlError>

Checks schema invariants that cannot be expressed by Serde types alone.

Provided Methods§

Source

fn parse_xml(document: &[u8]) -> Result<Self, PhoneXmlError>

Parses the exact schema root within Self::MAXIMUM_BYTES.

Source

fn parse_xml_with_limit( document: &[u8], maximum_bytes: usize, ) -> Result<Self, PhoneXmlError>

Parses the exact schema root within a caller-selected byte limit.

This is useful when a transport or device profile imposes a bound smaller than Self::MAXIMUM_BYTES.

Source

fn serialize_xml(&self) -> Result<String, PhoneXmlError>

Validates and serializes the document within Self::MAXIMUM_BYTES.

Source

fn serialize_xml_with_limit( &self, maximum_bytes: usize, ) -> Result<String, PhoneXmlError>

Validates and serializes the document within a caller-selected byte limit.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl PhoneXmlDocument for CiscoIpPhoneDirectory

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneDirectory"

Source§

const MAXIMUM_BYTES: usize = PHONE_DIRECTORY_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneExecute

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneExecute"

Source§

const MAXIMUM_BYTES: usize = PHONE_EXECUTE_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneIconFileMenu

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneIconFileMenu"

Source§

const MAXIMUM_BYTES: usize = PHONE_MENU_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneIconMenu

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneIconMenu"

Source§

const MAXIMUM_BYTES: usize = PHONE_MENU_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneImageList

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneImageList"

Source§

const MAXIMUM_BYTES: usize = PHONE_BACKGROUND_LIST_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneInput

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneInput"

Source§

const MAXIMUM_BYTES: usize = PHONE_INPUT_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneMenu

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneMenu"

Source§

const MAXIMUM_BYTES: usize = PHONE_MENU_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneStatus

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneStatus"

Source§

const MAXIMUM_BYTES: usize = PHONE_STATUS_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneStatusFile

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneStatusFile"

Source§

const MAXIMUM_BYTES: usize = PHONE_STATUS_MAX_BYTES

Source§

impl PhoneXmlDocument for CiscoIpPhoneText

Source§

const ROOT: &'static [u8] = b"CiscoIPPhoneText"

Source§

const MAXIMUM_BYTES: usize = PHONE_TEXT_MAX_BYTES