Struct winres_edit::Resource

source ·
pub struct Resource {
    pub kind: Id,
    pub name: Id,
    pub lang: u16,
    pub encoded: Arc<Mutex<Vec<u8>>>,
    pub decoded: Arc<Mutex<Option<ResourceData>>>,
    /* private fields */
}
Expand description

Structure representing a single resource

Fields§

§kind: Id

resource type

§name: Id

resource name

§lang: u16

u16 language associated with the resource

§encoded: Arc<Mutex<Vec<u8>>>

raw resource data

§decoded: Arc<Mutex<Option<ResourceData>>>

destructured resource data (not implemented)

Implementations§

source§

impl Resource

source

pub fn new( resources: &Resources, rtype: PCSTR, rname: PCSTR, rlang: u16, data: &[u8] ) -> Resource

Create a new resource instance bound to the Resources resource manager.

source

pub fn remove(&self) -> Result<&Self, Error>

Remove resource from the associated module (deletes the resource)

source

pub fn replace(&self, data: &[u8]) -> Result<&Self, Error>

Replace raw resource data with a user-supplied data. This only replaces the data in the resource structure. You must call Resource::update() following this call to update the resoruce data in the actual module.

source

pub fn update(&self) -> Result<&Self, Error>

Store this resource in the resource module (creates new or updates)

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 Debug for Resource

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.