pub struct BufferResource {
pub data: Arc<RwLock<Vec<u8>>>,
}
Expand description
§In-memory raw buffer resource
Fields§
§data: Arc<RwLock<Vec<u8>>>
The data representing the underlying resource
Trait Implementations§
Source§impl Debug for BufferResource
impl Debug for BufferResource
Source§impl ResourceProvider for BufferResource
impl ResourceProvider for BufferResource
Source§fn get_local_path(&self) -> Result<PathBuf, RustBertError>
fn get_local_path(&self) -> Result<PathBuf, RustBertError>
Source§fn get_resource(&self) -> Result<Resource<'_>, RustBertError>
fn get_resource(&self) -> Result<Resource<'_>, RustBertError>
Gets a wrapper referring to the in-memory resource.
§Returns
Resource
referring to the resource data
§Example
use rust_bert::resources::{BufferResource, ResourceProvider};
let data = std::fs::read("path/to/rust_model.ot").unwrap();
let weights_resource = BufferResource::from(data);
let weights = weights_resource.get_resource();
Auto Trait Implementations§
impl Freeze for BufferResource
impl RefUnwindSafe for BufferResource
impl Send for BufferResource
impl Sync for BufferResource
impl Unpin for BufferResource
impl UnwindSafe for BufferResource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more