1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use Read;
use crate;
/// Reads a [configuration](https://github.com/jiricekcz/fef-specification/blob/main/configuration/Configuration.md) from a byte stream using some configuration.
///
/// This is the most generic method for reading configuration. It assumes
/// that your application has some sort of default configuration that you
/// want to use instead of the default configuration provided by the standard.
///
/// Other than that, it functions the same as [`read_configuration_with_default_configuration`].
///
/// # Example
/// ```rust
/// # use fef::v0::read::read_configuration;
/// # use fef::v0::config::Config;
/// # use fef::v0::config::OverridableConfig;
/// # use fef::v0::config::DEFAULT_CONFIG;
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let bytes: Vec<u8> = vec![
/// 0x00, // 0 configurations
/// ];
///
/// let mut reader = &mut bytes.as_slice();
/// let config = read_configuration(&mut reader, &DEFAULT_CONFIG)?;
///
/// # assert!(reader.is_empty());
/// # Ok(())
/// # }
Sized + Read, C: ?Sized + Config>
/// Reads a [configuration](https://github.com/jiricekcz/fef-specification/blob/main/configuration/Configuration.md) from a byte stream using the default configuration.
///
/// This is the most common way of reading configurations of files you know
/// nothing about. It uses the default configuration provided by the standard.
///
/// # Example
/// ```rust
/// # use fef::v0::read::read_configuration_with_default_configuration;
/// # use fef::v0::config::Config;
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let bytes: Vec<u8> = vec![
/// 0x00, // 0 configurations
/// ];
///
/// let mut reader = &mut bytes.as_slice();
/// let config = read_configuration_with_default_configuration(&mut reader)?;
/// # assert!(reader.is_empty());
/// # Ok(())
/// # }
Sized + Read>