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 atpath
. - read_
from_ reader - Read a
Policy
document from any implementation ofstd::io::Read
. - read_
from_ string - Read a
Policy
document from a string. - write_
to_ file - Write the
policy
object to a file atpath
, 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 ofstd::io::Write
.