Struct adblock::resources::Resource

source ·
pub struct Resource {
    pub name: String,
    pub aliases: Vec<String>,
    pub kind: ResourceType,
    pub content: String,
    pub dependencies: Vec<String>,
    pub permission: PermissionMask,
}
Expand description

Struct representing a resource that can be used by an adblocking engine.

Fields§

§name: String

Represents the primary name of the resource, often a filename

§aliases: Vec<String>

Represents secondary names that can be used to access the resource

§kind: ResourceType

How to interpret the resource data within content

§content: String

The resource data, encoded using standard base64 configuration

§dependencies: Vec<String>

Optionally contains the name of any dependencies used by this resource. Currently, this only applies to application/javascript and fn/javascript MIME types.

Aliases should never be added to this list. It should only contain primary/canonical resource names.

Currently ignored, but will be respected in a future release. Bundle any required dependencies inside the resource for now.

§permission: PermissionMask

Optionally defines permission levels required to use this resource for a scriptlet injection. See PermissionMask for more details.

If there is any customized permission, this resource cannot be used for redirects.

This field is similar to the requiresTrust field from uBlock Origin’s scriptlet resources, except that it supports up to 8 different trust “domains”.

Trait Implementations§

source§

impl Clone for Resource

source§

fn clone(&self) -> Resource

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'de> Deserialize<'de> for Resource

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Resource

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> ToOwned for T
where T: Clone,

§

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

§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,