[][src]Struct cloudflare_soos::Scans

pub struct Scans {
    pub metadata_end: Option<usize>,
    pub first_scan_end: Option<usize>,
    pub good_scan_end: Option<usize>,
    pub file_size: usize,
}

Key positions in a progressive image file

cloudflare_soos::Scans::from_file(&input_file)?.cf_priority_change_headers()?;

Fields

metadata_end: Option<usize>

Byte position where metadata ends. This many bytes are preceeding start of pixel data. It's usually <200 bytes, unless the image has color profiles or other bloat.

first_scan_end: Option<usize>

Byte position where the first (lowest-quality) progressive scan ends. This many bytes are needed to display anything on screen. It's usually 12-15% of the file size.

good_scan_end: Option<usize>

Byte position where most of ok-quality pixel data ends. This many bytes are needed to display a good-enough image. It's usually about 50% of the file size.

file_size: usize

Size of the whole image file, in bytes

Implementations

impl Scans[src]

pub fn from_file(input_file: &[u8]) -> Result<Self>[src]

Analyze an image file to find byte ranges of its metadata and progressive scans

impl Scans[src]

pub fn cf_priority_change_headers(&self) -> Result<(String, String)>[src]

Assumes the priorities are:

  • 50 = critical js/css, fonts + image metadata
  • 30 = regular js/css, followed by other images + JPEG DC
  • 20 = low-priority image bodies
  • 10 = idle

Returns cf-priority and cf-priority-change header values, respectively.

Trait Implementations

impl Clone for Scans[src]

impl Debug for Scans[src]

impl Default for Scans[src]

impl PartialEq<Scans> for Scans[src]

impl StructuralPartialEq for Scans[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.