pub struct SerializationConfig {
pub pretty: bool,
pub base_iri: Option<String>,
pub prefixes: HashMap<String, String>,
pub use_prefixes: bool,
pub max_line_length: Option<usize>,
pub indent: String,
pub normalize_iris: bool,
}Expand description
Configuration for serialization
Fields§
§pretty: boolWhether to use pretty printing (with indentation and spacing)
base_iri: Option<String>Base IRI for relative IRI generation
prefixes: HashMap<String, String>Prefix declarations to use
use_prefixes: boolWhether to use prefix abbreviations
max_line_length: Option<usize>Maximum line length for formatting
indent: StringIndentation string (typically spaces or tabs)
normalize_iris: boolWhether to normalize IRIs per RFC 3987 during serialization
When enabled, IRIs are normalized to canonical form for consistent output:
- Case normalization (scheme and host to lowercase)
- Percent-encoding normalization (decode unreserved characters)
- Path normalization (remove dot segments)
- Default port removal (http:80, https:443, etc.)
This helps ensure consistent IRI representation across different systems.
Implementations§
Source§impl SerializationConfig
impl SerializationConfig
Sourcepub fn with_pretty(self, pretty: bool) -> Self
pub fn with_pretty(self, pretty: bool) -> Self
Enable or disable pretty printing
Sourcepub fn with_base_iri(self, base_iri: String) -> Self
pub fn with_base_iri(self, base_iri: String) -> Self
Set the base IRI
Sourcepub fn with_prefix(self, prefix: String, iri: String) -> Self
pub fn with_prefix(self, prefix: String, iri: String) -> Self
Add a prefix declaration
Sourcepub fn with_use_prefixes(self, use_prefixes: bool) -> Self
pub fn with_use_prefixes(self, use_prefixes: bool) -> Self
Set whether to use prefix abbreviations
Sourcepub fn with_max_line_length(self, max_length: Option<usize>) -> Self
pub fn with_max_line_length(self, max_length: Option<usize>) -> Self
Set the maximum line length
Sourcepub fn with_indent(self, indent: String) -> Self
pub fn with_indent(self, indent: String) -> Self
Set the indentation string
Sourcepub fn with_normalize_iris(self, normalize: bool) -> Self
pub fn with_normalize_iris(self, normalize: bool) -> Self
Enable or disable IRI normalization
When enabled, all IRIs in serialized output are normalized per RFC 3987 for consistent canonical representation.
§Example
use oxirs_ttl::toolkit::SerializationConfig;
let config = SerializationConfig::new()
.with_normalize_iris(true);
assert!(config.normalize_iris);Trait Implementations§
Source§impl Clone for SerializationConfig
impl Clone for SerializationConfig
Source§fn clone(&self) -> SerializationConfig
fn clone(&self) -> SerializationConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SerializationConfig
impl Debug for SerializationConfig
Auto Trait Implementations§
impl Freeze for SerializationConfig
impl RefUnwindSafe for SerializationConfig
impl Send for SerializationConfig
impl Sync for SerializationConfig
impl Unpin for SerializationConfig
impl UnsafeUnpin for SerializationConfig
impl UnwindSafe for SerializationConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more