From 91110b5140b051f020b42ac8fc8c52676d5d875a Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Mon, 22 Jun 2026 21:44:59 +0200 Subject: [PATCH] add DavContext add_namespace method --- dav-rs/src/dav/context.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dav-rs/src/dav/context.rs b/dav-rs/src/dav/context.rs index 5090278..0e00bde 100644 --- a/dav-rs/src/dav/context.rs +++ b/dav-rs/src/dav/context.rs @@ -27,6 +27,7 @@ */ #![allow(dead_code)] +use std::ffi::{c_char, CString}; use crate::dav::ffi; pub struct DavContext { @@ -39,6 +40,14 @@ impl DavContext { DavContext { ptr: dav_context_new() } } } + + pub fn add_namespace(&self, prefix: &str, namespace: &str) { + let prefix_cstr = CString::new(prefix).unwrap(); + let ns_cstr = CString::new(namespace).unwrap(); + unsafe { + dav_add_namespace(self.ptr, prefix_cstr.as_ptr(), ns_cstr.as_ptr()); + } + } } impl Drop for DavContext { @@ -65,4 +74,6 @@ unsafe extern "C" { fn dav_context_ref(ctx: *mut ffi::DavContext); fn dav_context_unref(ctx: *mut ffi::DavContext); + + fn dav_add_namespace(ctx: *mut ffi::DavContext, prefix: *const c_char, ns: *const c_char); } \ No newline at end of file -- 2.52.0