mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 08:12:24 +00:00
Remove now unnecessary generate_multistatus function
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use quick_xml::{events::attributes::Attribute, Writer};
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@@ -14,22 +12,3 @@ impl HrefElement {
|
|||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct TextNode(pub Option<String>);
|
pub struct TextNode(pub Option<String>);
|
||||||
|
|
||||||
pub fn generate_multistatus<'a, F, A>(namespaces: A, closure: F) -> Result<String>
|
|
||||||
where
|
|
||||||
F: FnOnce(&mut Writer<&mut Vec<u8>>) -> Result<(), quick_xml::Error>,
|
|
||||||
A: IntoIterator,
|
|
||||||
A::Item: Into<Attribute<'a>>,
|
|
||||||
{
|
|
||||||
let mut output_buffer = Vec::new();
|
|
||||||
let mut writer = Writer::new_with_indent(&mut output_buffer, b' ', 2);
|
|
||||||
writer
|
|
||||||
.create_element("multistatus")
|
|
||||||
.with_attributes(namespaces)
|
|
||||||
.write_inner_content(closure)?;
|
|
||||||
|
|
||||||
Ok(format!(
|
|
||||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n{}",
|
|
||||||
std::str::from_utf8(&output_buffer)?
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user