pub async fn read_user_file<'a>(
virtual_file_system: &'a VirtualFileSystem<'a>,
buffer: &mut Vec<u8>,
file: &str,
) -> Result<User>
Expand description
Reads and parses a user file from the filesystem.
This function is used internally to load user data from JSON files.
It reads the file contents into the provided buffer and deserializes
the JSON data into a User_type
structure.
§Arguments
Virtual_file_system
- Reference to the virtual file systemBuffer
- Mutable buffer to use for reading file contentsFile
- Name of the user file to read
§Returns
Returns Ok(User_type)
with the parsed user data,
or an appropriate error if reading or parsing fails.
§Errors
- Path construction failures
- File system errors (opening, reading)
- JSON parsing errors