qubit_redact/facade/redactor/uri.rs
1// =============================================================================
2// Copyright (c) 2025 - 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Generic URI redaction operations.
9
10use super::Redactor;
11use crate::RedactionInspection;
12use crate::RedactionInspectionError;
13use crate::RedactionTextOutput;
14
15impl Redactor {
16 /// Redacts a URI through one completed text transaction.
17 #[must_use]
18 pub fn redact_uri(&self, input: &str) -> RedactionTextOutput {
19 let mut session = self.text_runtime();
20 session.uri(|uri| {
21 let _ = uri.value(input);
22 });
23 session.finish()
24 }
25
26 /// Inspects one URI without rendering it.
27 ///
28 /// # Errors
29 ///
30 /// Returns [`RedactionInspectionError`] when URI parsing fails or a
31 /// shared resource limit prevents complete inspection.
32 pub fn inspect_uri(&self, input: &str) -> Result<RedactionInspection, RedactionInspectionError> {
33 let mut session = self.inspection_runtime();
34 crate::formats::uri::inspection::inspect_uri(&mut session, input);
35 session.finish()
36 }
37}