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

Method derive_from_reader

alpm-srcinfo/src/schema.rs:71–84  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected