Module io

Source
Expand description

Provides basic file read/write functions for policies.

This module wraps basic read and write operations and the relevant Serde serialization and deserialization logic. Both read and write functions come in two forms, one which takes a file name in the form of a PathBuf and one which either takes an implementation of std::io::Read or std::io::Write.

§Example

The following reads a policy document from a JSON file and returns the parsed form.

use aws_iam::{io, model::*};
use std::path::PathBuf;

let policy = io::read_from_file(
        &PathBuf::from("tests/data/good/example-021.json")
    ).expect("Error reading file");

Enums§

Error
Errors possible with file read/write.

Functions§

read_from_file
Read a Policy document from the file at path.
read_from_reader
Read a Policy document from any implementation of std::io::Read.
read_from_string
Read a Policy document from a string.
write_to_file
Write the policy object to a file at path, this will create a file if it does not exist and overwrite any file if it exists.
write_to_writer
Write the policy object to any implementation of std::io::Write.