Skip to main content

LinkHost

Trait LinkHost 

Source
pub trait LinkHost {
    // Required methods
    fn kind(&self, path: &str) -> Option<HostKind>;
    fn find_entry(&self, archive: &str, entry: &str) -> Option<String>;
    fn entry_point(&self, archive: &str) -> Option<String>;

    // Provided methods
    fn host_location(&self) -> bool { ... }
    fn outside_links(&self) -> bool { ... }
    fn links_into_archives(&self) -> bool { ... }
    fn trust_root(&self) -> Option<&str> { ... }
    fn is_allowed(&self, _path: &str) -> bool { ... }
    fn load_outside_resources(&self) -> bool { ... }
}
Expand description

What link resolution needs to know about the files around an archive.

Host paths are /-separated and relative to the host’s root. The capability and trust methods have defaults matching the spec: links may leave archives and go into them, the whole host is trusted, and embeds never load resources from outside an archive.

Required Methods§

Source

fn kind(&self, path: &str) -> Option<HostKind>

What exists at path, or None.

Source

fn find_entry(&self, archive: &str, entry: &str) -> Option<String>

The stored entry path in archive matching entry (NFC, case-sensitive), or None.

Source

fn entry_point(&self, archive: &str) -> Option<String>

The entry point of archive (Section 5.5), or None.

Provided Methods§

Source

fn host_location(&self) -> bool

Whether the source archive has a location on this host (Section 9.4).

Whether links may leave an archive (Section 9.4).

Whether links may point into archives (Section 9.5).

Source

fn trust_root(&self) -> Option<&str>

The trust boundary (Section 9.6): targets outside it are denied. Some("") trusts the whole host; None trusts no location at all.

Source

fn is_allowed(&self, _path: &str) -> bool

Host paths outside the boundary that the user explicitly allowed.

Source

fn load_outside_resources(&self) -> bool

Whether embeds may load resources from outside an archive (inside the trust boundary only).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§