package_json_schema 0.3.0

Parse content from `package.json` content and consume the result as a `PackageJson` struct.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// The errors resulting from parsing files.
///
/// Structure taken from [here](https://kazlauskas.me/entries/errors).
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
pub enum Error {
	#[error("an unknown `package_json_schema` error has occurred")]
	Unknown,

	#[error("failure to parse a package.json from provided content")]
	ParsePackageJson(#[source] serde_json::Error),

	#[error("failure to serialize the current `PackageJson` instance")]
	SerializePackageJson(#[source] serde_json::Error),
}

/// A result type for `package_json_schema`.
pub type Result<T> = std::result::Result<T, Error>;