Enum ckb_resource::Resource[][src]

pub enum Resource {
    Bundled {
        bundled: String,
    },
    FileSystem {
        file: PathBuf,
    },
}
Expand description

Represents a resource, which is either bundled in the CKB binary or resident in the local file system.

Variants

Bundled

A resource that bundled in the CKB binary.

Fields of Bundled

bundled: String

The identifier of the bundled resource.

FileSystem

A resource that resides in the local file system.

Fields of FileSystem

file: PathBuf

The file path to the resource.

Implementations

Creates a reference to the bundled resource.

Creates a reference to the resource recident in the file system.

Creates the CKB config file resource from the file system.

It searches the file name CKB_CONFIG_FILE_NAME in the directory root_dir.

Creates the CKB miner config file resource from the file system.

It searches the file name MINER_CONFIG_FILE_NAME in the directory root_dir.

Creates the RocksDB options file resource from the file system.

It searches the file name DB_OPTIONS_FILE_NAME in the directory root_dir.

Creates the bundled CKB config file resource.

Creates the bundled CKB miner config file resource.

Creates the bundled RocksDB options file resource.

Checks whether any of the bundled resource has been exported in the specified directory.

This can be used to avoid overwritting to export all the bundled resources to the specified directory.

Returns true if this is a bundled resource.

Returns true if the resource exists.

The bundled resource exists only when the identifier is included in the bundle.

The file system resource exists only when the file exists.

The parent directory of the resource.

It always returns None on bundled resource.

Modifies the file system resource to ensure the path is absolute.

If the path is relative, expand the path relative to the directory base.

Gets resource content.

Gets resource content via an input stream.

Exports a bundled resource.

This function returns Ok immediatly when invoked on a file system resource.

The file is exported to the path by combining root_dir and the resource indentifier.

These bundled files can be customized for different chains using spec branches. See Template.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.