[−][src]Struct ckb_std::dynamic_loading::CKBDLContext
Dynamic loading context T represent a buffer type, for example: [u8; 64 * 1024], the size of T must aligned with PAGE_SIZE 4096.
Methods
impl<T> CKBDLContext<T>
[src]
pub fn new() -> Self
[src]
Create instance of dynamic loading context
pub fn load<'a>(
&'a mut self,
dep_cell_data_hash: &[u8]
) -> Result<Library, Error>
[src]
&'a mut self,
dep_cell_data_hash: &[u8]
) -> Result<Library, Error>
Load a shared library from dep cells See module level documentation for details
pub fn load_with_offset<'a>(
&'a mut self,
dep_cell_data_hash: &[u8],
offset: usize,
size: usize
) -> Result<Library, Error>
[src]
&'a mut self,
dep_cell_data_hash: &[u8],
offset: usize,
size: usize
) -> Result<Library, Error>
Load a shared library from dep cells to specified buffer offset. See module level documentation for details
This function is used for loading multiple libraries.
Example
let mut context = CKBDLContext::<[u8; 64 * 1024]>::new(); let mut size = size_of_val(&context); let mut offset = 0; let lib1 = context.load(&CODE_HASH_LIB_1).expect("load shared lib"); size -= lib1.consumed_size() offset += lib1.consumed_size() let lib2 = context.load_with_offset(&CODE_HASH_LIB_2, offset, size).expect("load shared lib"); size -= lib2.consumed_size() offset += lib2.consumed_size() let lib3 = context.load_with_offset(&CODE_HASH_LIB_3, offset, size).expect("load shared lib");
Auto Trait Implementations
impl<T> Send for CKBDLContext<T> where
T: Send,
T: Send,
impl<T> Sync for CKBDLContext<T> where
T: Sync,
T: Sync,
impl<T> Unpin for CKBDLContext<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,