Struct Archive

Source
pub struct Archive(/* private fields */);
Expand description

Sciter compressed archive.

An archive is produced by packfolder tool (from SDK) that creates a single blob with compressed resources. It allows to use the same resource pack uniformly across different platforms.

For example, app resource files (HTML/CSS/scripts) can be stored in an assets folder that can be packed into a single archive by calling packfolder.exe assets target/assets.rc -binary. And later it can be accessed via the Archive API explicitly:

let archived = include_bytes!("target/assets.rc");
let assets = sciter::host::Archive::open(archived).expect("Unable to load archive.");

// access `assets/index.htm`
let html_data = assets.get("index.htm").unwrap();

or implicitly via the this://app/ URL after registering the archive via Window::archive_handler:


let archived = include_bytes!("target/assets.rc");
let mut frame = sciter::Window::new();
frame.archive_handler(archived).expect("Unable to load archive");
frame.load("this://app/index.htm");

Implementations§

Source§

impl Archive

Source

pub fn open(archived: &[u8]) -> Result<Self>

Open an archive blob.

Source

pub fn get(&self, path: &str) -> Option<&[u8]>

Get an archive item.

Given a path, returns a reference to the contents of an archived item.

Trait Implementations§

Source§

impl Drop for Archive

Close the archive.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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, 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.