Skip to main content

Image

Struct Image 

Source
pub struct Image { /* private fields */ }
Expand description

An embedded image.

See [MS-ONE] 2.2.24.

Implementations§

Source§

impl Image

Source

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.

Source

pub fn size(&self) -> Option<u64>

The size of the image in bytes, or None if not yet uploaded.

Source

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.

Source

pub fn extension(&self) -> Option<&str>

The image’s file extension.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn layout_alignment_self(&self) -> Option<LayoutAlignment>

The image’s alignment.

See [MS-ONE] 2.3.33.

Source

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.

Source

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.

Source

pub fn text(&self) -> Option<&str>

The text for the image.

Source

pub fn text_language_code(&self) -> Option<u32>

The text’s language code (MS-LCID)

Source

pub fn picture_width(&self) -> Option<f32>

The image’s width in half-inch increments.

See [MS-ONE] 2.3.100.

Source

pub fn picture_height(&self) -> Option<f32>

The image’s height in half-inch increments.

See [MS-ONE] 2.3.101.

A hyperlink associated with this image.

Source

pub fn offset_horizontal(&self) -> Option<f32>

The horizontal offset from the page origin in half-inch increments.

See [MS-ONE] 2.3.18.

Source

pub fn offset_vertical(&self) -> Option<f32>

The vertical offset from the page origin in half-inch increments.

See [MS-ONE] 2.3.19.

Source

pub fn is_background(&self) -> bool

Whether the image is a background image.

See [MS-ONE] 2.3.61.

Source

pub fn note_tags(&self) -> &[NoteTag]

Note tags for this image.

Source

pub fn embeds(&self) -> &[IFrame]

Embedded iframes for this image.

Trait Implementations§

Source§

impl Clone for Image

Source§

fn clone(&self) -> Image

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Image

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Image

Source§

fn eq(&self, other: &Image) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.