pub struct Mdoc { /* private fields */ }Expand description
§=========================== Root MDOC (owned, editable)
Implementations§
Source§impl Mdoc
impl Mdoc
Sourcepub fn from_reader<R: BufRead>(reader: R) -> Result<Self, ParseError>
pub fn from_reader<R: BufRead>(reader: R) -> Result<Self, ParseError>
Streaming parse into an owned, editable MDOC
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, ParseError>
pub fn header(&self) -> &[HeaderEntry]
pub fn tilt_series(&self) -> &[ZBlock]
pub fn tilt_image(&self, z: usize) -> Option<&ZBlock>
pub fn tilt_image_mut(&mut self, z: usize) -> Option<&mut ZBlock>
pub fn write<W: Write>(&self, w: W) -> Result<()>
Sourcepub fn write_lossless<W: Write>(&self, w: W) -> Result<()>
pub fn write_lossless<W: Write>(&self, w: W) -> Result<()>
Write with original formatting (lossless round-trip)
This method writes the MDOC file using the original raw values if they were captured, ensuring a true lossless round-trip.
Source§impl Mdoc
impl Mdoc
Sourcepub fn normalize_spaces(&mut self)
pub fn normalize_spaces(&mut self)
Normalize multiple spaces to single space in all values
pub fn to_json(&self) -> Result<String, Error>
pub fn from_json(json: &str) -> Result<Self, Error>
Sourcepub fn normalize_format(&mut self)
pub fn normalize_format(&mut self)
Normalize all formats in the MDOC file
This method combines space normalization and key-value format normalization. It handles various input styles and produces a consistent output format.
Handles formats like:
Defocus = -5.0;(standard)Defocus=-5.0;(no spaces around =)Defocus = -5.0(no semicolon)Key = value with spaces;(extra spaces)"Value"(quoted)
Returns normalized format: Key = value;
Note: Raw values are automatically captured during parsing, so lossless
round-trip is always available via write_lossless().
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mdoc
impl<'de> Deserialize<'de> for Mdoc
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Mdoc
impl RefUnwindSafe for Mdoc
impl Send for Mdoc
impl Sync for Mdoc
impl Unpin for Mdoc
impl UnwindSafe for Mdoc
Blanket Implementations§
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
Mutably borrows from an owned value. Read more