MCPcopy Create free account
hub / github.com/archlinux/alpm / derive_from_reader

Method derive_from_reader

alpm-buildinfo/src/schema.rs:70–83  ·  view source on GitHub ↗

Derives a [`BuildInfoSchema`] from BUILDINFO data in a `reader`. Reads the `reader` to string and defers to [`BuildInfoSchema::derive_from_str`]. # Errors Returns an error if - reading a [`String`] from `reader` fails - or deriving a [`BuildInfoSchema`] from the contents of `reader` fails.

(reader: impl std::io::Read)

Source from the content-addressed store, hash-verified

68 /// - reading a [`String`] from `reader` fails
69 /// - or deriving a [`BuildInfoSchema`] from the contents of `reader` fails.
70 fn derive_from_reader(reader: impl std::io::Read) -> Result<Self, Error>
71 where
72 Self: Sized,
73 {
74 let mut buf = String::new();
75 let mut reader = reader;
76 reader
77 .read_to_string(&mut buf)
78 .map_err(|source| Error::IoRead {
79 context: t!("error-io-derive-schema-data"),
80 source,
81 })?;
82 Self::derive_from_str(&buf)
83 }
84
85 /// Derives a [`BuildInfoSchema`] from a string slice containing BUILDINFO data.
86 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected