Struct cor_args::FileHandler
source · pub struct FileHandler { /* private fields */ }Expand description
A handler for retrieving values from a file.
This struct is responsible for handling requests by checking for values within a specified file. (The actual file reading logic is not yet implemented in the provided code.)
Implementations§
source§impl FileHandler
impl FileHandler
sourcepub fn new<P>(file_path: P) -> Self
pub fn new<P>(file_path: P) -> Self
Creates a new FileHandler with the specified file path and an optional next handler.
Arguments
file_path- The path to the file from which values are to be retrieved.next- An optional next handler to which requests can be delegated if this handler can’t fulfill them.
pub fn next(self, handler: Box<dyn Handler>) -> Self
Trait Implementations§
source§impl Handler for FileHandler
impl Handler for FileHandler
source§fn handle_request(&self, key: &str) -> Option<String>
fn handle_request(&self, key: &str) -> Option<String>
Retrieves content from the specified file.
This implementation attempts to read content from the file specified by file_path.
If reading fails, and if a next handler is provided, it delegates the request
to the next handler. If there’s no next handler or if the file reading fails,
it returns None.
Arguments
key- The key for which the value needs to be retrieved. (Note: Thekeyis currently unused in the reading logic.)
Auto Trait Implementations§
impl !RefUnwindSafe for FileHandler
impl !Send for FileHandler
impl !Sync for FileHandler
impl Unpin for FileHandler
impl !UnwindSafe for FileHandler
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