Skip to main content

instant_epp/
common.rs

1//! Common data types included in EPP Requests and Responses
2
3use std::borrow::Cow;
4
5use instant_xml::{FromXml, ToXml};
6
7use crate::request::Extension;
8
9pub(crate) const EPP_XMLNS: &str = "urn:ietf:params:xml:ns:epp-1.0";
10
11#[derive(Debug, Eq, PartialEq, ToXml)]
12pub struct NoExtension;
13
14impl<'xml> FromXml<'xml> for NoExtension {
15    fn matches(_: instant_xml::Id<'_>, _: Option<instant_xml::Id<'_>>) -> bool {
16        false
17    }
18
19    fn deserialize<'cx>(
20        _: &mut Self::Accumulator,
21        _: &'static str,
22        _: &mut instant_xml::Deserializer<'cx, 'xml>,
23    ) -> Result<(), instant_xml::Error> {
24        unreachable!()
25    }
26
27    type Accumulator = Option<Self>;
28    const KIND: instant_xml::Kind = instant_xml::Kind::Element;
29}
30
31impl Extension for NoExtension {
32    type Response = Self;
33}
34
35/// The `<svcExtension>` type in EPP XML
36#[derive(Debug, Eq, FromXml, PartialEq, ToXml)]
37#[xml(rename = "svcExtension", ns(EPP_XMLNS))]
38pub struct ServiceExtension<'a> {
39    /// The service extension URIs being represented by `<extURI>` in EPP XML
40    #[xml(rename = "extURI")]
41    pub ext_uris: Vec<Cow<'a, str>>,
42}