Skip to main content

load_from_file

Function load_from_file 

Source
pub async fn load_from_file(path: &Path) -> Result<Vec<SessionEntry>>
Expand description

Loads and deserializes session entries from a file

Reads the specified session file and parses its contents into a vector of SessionEntry objects using atomic read operations.

§Arguments

  • path - Path to the session file to load

§Returns

Result containing a Vec of SessionEntry objects or an IO error

§Errors

Returns an error if:

  • The file cannot be read (permission denied, not found, etc.)
  • The file contains invalid UTF-8

§Example

use aria2_core::session::session_serializer::load_from_file;
use std::path::Path;

#[tokio::main]
async fn main() {
    let path = Path::new("aria2.session");
    let _entries = load_from_file(path).await.unwrap();
}