use xmlserde_derives::XmlDeserialize; use crate::{ attribute::Attribute, documentation::{DocDeprecated, DocStability, DocVersion, Documentation, SourcePosition}, parameter::Parameters, prelude::*, return_value::ReturnValue, version::Version, Stability, }; #[derive(Clone, Debug, XmlDeserialize)] #[xmlserde(root = b"callback")] #[xmlserde(deny_unknown_fields)] pub struct Callback { #[xmlserde(name = b"name", ty = "attr")] name: String, #[xmlserde(name = b"c:type", ty = "attr")] c_type: Option, #[xmlserde(name = b"throws", ty = "attr")] throws: Option, // Common attributes #[xmlserde(name = b"introspectable", ty = "attr")] introspectable: Option, #[xmlserde(name = b"deprecated", ty = "attr")] deprecated: Option, #[xmlserde(name = b"version", ty = "attr")] version: Option, #[xmlserde(name = b"deprecated-version", ty = "attr")] deprecated_version: Option, #[xmlserde(name = b"stability", ty = "attr")] stability: Option, // Documentation #[xmlserde(name = b"doc", ty = "child")] doc: Option, #[xmlserde(name = b"doc-deprecated", ty = "child")] doc_deprecated: Option, #[xmlserde(name = b"doc-stability", ty = "child")] doc_stability: Option, #[xmlserde(name = b"doc-version", ty = "child")] doc_version: Option, #[xmlserde(name = b"source-position", ty = "child")] source_position: Option, // Attributes: 0 or more #[xmlserde(name = b"attribute", ty = "child")] attributes: Vec, #[xmlserde(name = b"return-value", ty = "child")] return_value: ReturnValue, #[xmlserde(name = b"parameters", ty = "child", default = "Parameters::default")] parameters: Parameters, } impl Callback { pub fn name(&self) -> &str { &self.name } pub fn c_type(&self) -> Option<&str> { self.c_type.as_deref() } } impl_info!(Callback); impl_attributable!(Callback); impl_documentable!(Callback); impl_function_like!(Callback);