pub trait ResourceProvider:
Debug
+ Send
+ Sync {
// Required methods
fn get_local_path(&self) -> Result<PathBuf, RustBertError>;
fn get_resource(&self) -> Result<Resource<'_>, RustBertError>;
}
Expand description
§Resource Trait that can provide the location or data for the model, and location of
configuration or vocabulary resources
Required Methods§
Sourcefn get_local_path(&self) -> Result<PathBuf, RustBertError>
fn get_local_path(&self) -> Result<PathBuf, RustBertError>
Provides the local path for a resource.
§Returns
PathBuf
pointing to the resource file
§Example
use rust_bert::resources::{LocalResource, ResourceProvider};
use std::path::PathBuf;
let config_resource = LocalResource {
local_path: PathBuf::from("path/to/config.json"),
};
let config_path = config_resource.get_local_path();