Skip to main content

Redactor

Struct Redactor 

Source
pub struct Redactor<'a> { /* private fields */ }
Expand description

The pass’s state across one document: the pseudonym numbering and the report. DoclingDocument::redact drives it over a whole document; the streaming converter drives it over each page batch so the Markdown it emits matches the buffered export byte for byte.

Implementations§

Source§

impl<'a> Redactor<'a>

Source

pub fn new(opts: &'a RedactionOptions, detector: &'a dyn PiiDetector) -> Self

Source

pub fn report(&self) -> &RedactionReport

The report so far (the final one after the last batch).

Source

pub fn finish(self) -> RedactionReport

Source

pub fn has_pii(&self, text: &str) -> bool

Whether text carries any span the options keep — what the image box-out asks per OCR line.

Source

pub fn redact_text(&mut self, text: &mut String)

Redact one string in place.

Source

pub fn redact_runs(&mut self, runs: &mut [InlineRun])

Redact a run sequence as one text: spans are found on the joined runs and written back — the run the span starts in gets the placeholder, the runs it crosses lose the covered characters.

Source

pub fn redact_nodes(&mut self, nodes: &mut [Node])

Redact every string of nodes, recursively.

Source

pub fn redact_tree(&mut self, tree: &mut ItemTree)

Redact the item tree (#621: the JSON export reads it, not the nodes, for the backends that build one). The same pseudonym numbering as the nodes got; the counts are not incremented again — the tree is the same text in docling’s shape, not more of it.

Redact the link table ((text, href) pairs).

Source

pub fn redact_document(&mut self, doc: &mut DoclingDocument)

The whole document: nodes, tree, links, page renders.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Redactor<'a>

§

impl<'a> !Send for Redactor<'a>

§

impl<'a> !Sync for Redactor<'a>

§

impl<'a> !UnwindSafe for Redactor<'a>

§

impl<'a> Freeze for Redactor<'a>

§

impl<'a> Unpin for Redactor<'a>

§

impl<'a> UnsafeUnpin for Redactor<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.