pub struct BytecodeCache { /* private fields */ }Expand description
On-disk bytecode cache stored under ~/.shape/cache/bytecode/
Implementations§
Source§impl BytecodeCache
impl BytecodeCache
Sourcepub fn new() -> Option<Self>
pub fn new() -> Option<Self>
Create a new bytecode cache, creating the cache directory if needed.
The cache lives at ~/.shape/cache/bytecode/. Returns None if the
home directory cannot be determined or the directory cannot be created.
Sourcepub fn with_dir(cache_dir: PathBuf) -> Result<Self>
pub fn with_dir(cache_dir: PathBuf) -> Result<Self>
Create a cache at a specific directory (for testing).
Sourcepub fn get(&self, source: &str) -> Option<BytecodeProgram>
pub fn get(&self, source: &str) -> Option<BytecodeProgram>
Look up cached bytecode for the given source content.
Returns Some(program) on cache hit, None on miss or deserialization error.
Auto Trait Implementations§
impl Freeze for BytecodeCache
impl RefUnwindSafe for BytecodeCache
impl Send for BytecodeCache
impl Sync for BytecodeCache
impl Unpin for BytecodeCache
impl UnsafeUnpin for BytecodeCache
impl UnwindSafe for BytecodeCache
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