pub struct Image { /* private fields */ }Expand description
An embedded image.
See [MS-ONE] 2.2.24.
Implementations§
Source§impl Image
impl Image
Sourcepub fn read(&self) -> Option<Box<dyn Read>>
pub fn read(&self) -> Option<Box<dyn Read>>
A [Read] over the image’s binary data.
Bytes are pulled lazily from the underlying crate::fs::FileSource.
Returns None if the image data hasn’t been uploaded yet. Call
data_status before reading to distinguish
invalid data from a valid zero-byte payload.
Sourcepub fn data_status(&self) -> FileDataStatus
pub fn data_status(&self) -> FileDataStatus
Availability of the image’s binary data.
Consumers should render a broken-content indicator for
FileDataStatus::Invalid instead of treating it as a valid
zero-byte image.
Sourcepub fn layout_max_width(&self) -> Option<f32>
pub fn layout_max_width(&self) -> Option<f32>
The maximum width to display the image in half-inch increments.
See [MS-ONE] 2.3.21.
Sourcepub fn layout_max_height(&self) -> Option<f32>
pub fn layout_max_height(&self) -> Option<f32>
The maximum height to display the image in half-inch increments.
See [MS-ONE] 2.3.23.
Sourcepub fn alt_text(&self) -> Option<&str>
pub fn alt_text(&self) -> Option<&str>
Alternative text for the image.
Usually this seems to be the result of OneNote’s OCR processing.
See [MS-ONE] 2.2.79.
Sourcepub fn layout_alignment_in_parent(&self) -> Option<LayoutAlignment>
pub fn layout_alignment_in_parent(&self) -> Option<LayoutAlignment>
The image’s alignment relative to the containing outline element (if present).
See [MS-ONE] 2.3.27.
Sourcepub fn layout_alignment_self(&self) -> Option<LayoutAlignment>
pub fn layout_alignment_self(&self) -> Option<LayoutAlignment>
The image’s alignment.
See [MS-ONE] 2.3.33.
Sourcepub fn image_filename(&self) -> Option<&str>
pub fn image_filename(&self) -> Option<&str>
The image’s original file name.
See [MS-ONE] 2.2.75.
§Untrusted input
This string is metadata from the parsed OneNote file and is
fully controlled by whoever authored that file. It may contain
path separators (/, \), parent-directory components (..),
NUL bytes, Windows reserved device names (CON, COM1, …),
extremely long sequences, or arbitrary Unicode. Consumers
that use this value as part of a write path on disk must
sanitise it themselves — typically with sanitize_filename
or equivalent. Passing it unmodified to std::fs::File::create
is a path-traversal / device-handle vulnerability.
Sourcepub fn displayed_page_number(&self) -> Option<u32>
pub fn displayed_page_number(&self) -> Option<u32>
The page number to display if the image file contains multiple pages (e.g. XPS, PDF).
See [MS-ONE] 2.3.95.
Sourcepub fn text_language_code(&self) -> Option<u32>
pub fn text_language_code(&self) -> Option<u32>
The text’s language code (MS-LCID)
Sourcepub fn picture_width(&self) -> Option<f32>
pub fn picture_width(&self) -> Option<f32>
The image’s width in half-inch increments.
See [MS-ONE] 2.3.100.
Sourcepub fn picture_height(&self) -> Option<f32>
pub fn picture_height(&self) -> Option<f32>
The image’s height in half-inch increments.
See [MS-ONE] 2.3.101.
Sourcepub fn hyperlink_url(&self) -> Option<&str>
pub fn hyperlink_url(&self) -> Option<&str>
A hyperlink associated with this image.
Sourcepub fn offset_horizontal(&self) -> Option<f32>
pub fn offset_horizontal(&self) -> Option<f32>
The horizontal offset from the page origin in half-inch increments.
See [MS-ONE] 2.3.18.
Sourcepub fn offset_vertical(&self) -> Option<f32>
pub fn offset_vertical(&self) -> Option<f32>
The vertical offset from the page origin in half-inch increments.
See [MS-ONE] 2.3.19.
Sourcepub fn is_background(&self) -> bool
pub fn is_background(&self) -> bool
Whether the image is a background image.
See [MS-ONE] 2.3.61.
Note tags for this image.
Trait Implementations§
impl StructuralPartialEq for Image
Auto Trait Implementations§
impl !RefUnwindSafe for Image
impl !UnwindSafe for Image
impl Freeze for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnsafeUnpin for Image
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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