Struct move_cli::sandbox::utils::on_disk_state_view::OnDiskStateView
source · [−]pub struct OnDiskStateView { /* private fields */ }Implementations
sourceimpl OnDiskStateView
impl OnDiskStateView
sourcepub fn create<P: Into<PathBuf>>(build_dir: P, storage_dir: P) -> Result<Self>
pub fn create<P: Into<PathBuf>>(build_dir: P, storage_dir: P) -> Result<Self>
Create an OnDiskStateView that reads/writes resource data and modules in storage_dir.
pub fn build_dir(&self) -> &PathBuf
pub fn struct_layouts_file(&self) -> PathBuf
pub fn is_resource_path(&self, p: &Path) -> bool
pub fn is_event_path(&self, p: &Path) -> bool
pub fn is_module_path(&self, p: &Path) -> bool
sourcepub fn get_module_id(&self, p: &Path) -> Option<ModuleId>
pub fn get_module_id(&self, p: &Path) -> Option<ModuleId>
Extract a module ID from a path
sourcepub fn get_resource_bytes(
&self,
addr: AccountAddress,
tag: StructTag
) -> Result<Option<Vec<u8>>>
pub fn get_resource_bytes(
&self,
addr: AccountAddress,
tag: StructTag
) -> Result<Option<Vec<u8>>>
Read the resource bytes stored on-disk at addr/tag
sourcepub fn has_module(&self, module_id: &ModuleId) -> bool
pub fn has_module(&self, module_id: &ModuleId) -> bool
Check if a module at addr/module_id exists
sourcepub fn resolve_function(
&self,
module_id: &ModuleId,
idx: u16
) -> Result<Option<Identifier>>
pub fn resolve_function(
&self,
module_id: &ModuleId,
idx: u16
) -> Result<Option<Identifier>>
Return the name of the function at idx in module_id
sourcepub fn view_resource(
&self,
resource_path: &Path
) -> Result<Option<AnnotatedMoveStruct>>
pub fn view_resource(
&self,
resource_path: &Path
) -> Result<Option<AnnotatedMoveStruct>>
Returns a deserialized representation of the resource value stored at resource_path.
Returns Err if the path does not hold a resource value or the resource cannot be deserialized
pub fn view_events(&self, events_path: &Path) -> Result<Vec<AnnotatedMoveValue>>
pub fn view_module(module_path: &Path) -> Result<Option<String>>
pub fn view_script(script_path: &Path) -> Result<Option<String>>
sourcepub fn delete_resource(&self, addr: AccountAddress, tag: StructTag) -> Result<()>
pub fn delete_resource(&self, addr: AccountAddress, tag: StructTag) -> Result<()>
Delete resource stored on disk at the path addr/tag
pub fn save_resource(
&self,
addr: AccountAddress,
tag: StructTag,
bcs_bytes: &[u8]
) -> Result<()>
pub fn save_event(
&self,
event_key: &[u8],
event_sequence_number: u64,
event_type: TypeTag,
event_data: Vec<u8>
) -> Result<()>
sourcepub fn save_module(&self, module_id: &ModuleId, module_bytes: &[u8]) -> Result<()>
pub fn save_module(&self, module_id: &ModuleId, module_bytes: &[u8]) -> Result<()>
Save module on disk under the path module.address()/module.name()
sourcepub fn save_struct_layouts(&self, layouts: &str) -> Result<()>
pub fn save_struct_layouts(&self, layouts: &str) -> Result<()>
Save the YAML encoding layout on disk under build_dir/layouts/id.
sourcepub fn save_modules<'a>(
&self,
modules: impl IntoIterator<Item = &'a (ModuleId, Vec<u8>)>
) -> Result<()>
pub fn save_modules<'a>(
&self,
modules: impl IntoIterator<Item = &'a (ModuleId, Vec<u8>)>
) -> Result<()>
Save all the modules in the local cache, re-generate mv_interfaces if required.
pub fn delete_module(&self, id: &ModuleId) -> Result<()>
pub fn resource_paths(&self) -> impl Iterator<Item = PathBuf> + '_
pub fn module_paths(&self) -> impl Iterator<Item = PathBuf> + '_
pub fn event_paths(&self) -> impl Iterator<Item = PathBuf> + '_
sourcepub fn get_all_modules(&self) -> Result<Vec<CompiledModule>>
pub fn get_all_modules(&self) -> Result<Vec<CompiledModule>>
Build all modules in the self.storage_dir. Returns an Err if a module does not deserialize.
Trait Implementations
sourceimpl Debug for OnDiskStateView
impl Debug for OnDiskStateView
sourceimpl Default for OnDiskStateView
impl Default for OnDiskStateView
sourceimpl GetModule for &OnDiskStateView
impl GetModule for &OnDiskStateView
type Error = Error
type Item = CompiledModule
fn get_module_by_id(
&self,
id: &ModuleId
) -> Result<Option<CompiledModule>, Self::Error>
sourceimpl ModuleResolver for OnDiskStateView
impl ModuleResolver for OnDiskStateView
sourceimpl ResourceResolver for OnDiskStateView
impl ResourceResolver for OnDiskStateView
Auto Trait Implementations
impl RefUnwindSafe for OnDiskStateView
impl Send for OnDiskStateView
impl Sync for OnDiskStateView
impl Unpin for OnDiskStateView
impl UnwindSafe for OnDiskStateView
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<E, T> MoveResolver for T where
T: ModuleResolver<Error = E> + ResourceResolver<Error = E> + ?Sized,
E: Debug,
impl<E, T> MoveResolver for T where
T: ModuleResolver<Error = E> + ResourceResolver<Error = E> + ?Sized,
E: Debug,
type Err = E
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more