apple_clis/codesign/sign/
output.rs

1use crate::prelude::*;
2
3#[derive(Debug, Serialize)]
4#[non_exhaustive]
5#[must_use = include_doc!(must_use_cmd_output)]
6pub enum SignOutput {
7	#[doc = include_doc!(cmd_error)]
8	ErrorUnImplemented { stderr: String },
9
10	#[doc = include_doc!(cmd_success)]
11	SuccessUnImplemented { stdout: String },
12}
13
14impl CommandNomParsable for SignOutput {
15	fn success_unimplemented(stdout: String) -> Self {
16		Self::SuccessUnImplemented { stdout }
17	}
18
19	fn error_unimplemented(stderr: String) -> Self {
20		Self::ErrorUnImplemented { stderr }
21	}
22}
23
24impl PublicCommandOutput for SignOutput {
25	type PrimarySuccess = ();
26
27	fn success(&self) -> Result<&Self::PrimarySuccess> {
28		match self.successful() {
29			true => Ok(&()),
30			false => Err(Error::output_errored(self))
31		}
32	}
33
34	fn successful(&self) -> bool {
35		matches!(self, Self::SuccessUnImplemented { .. })
36	}
37}