Struct apple_codesign::UnifiedSigner
source · pub struct UnifiedSigner<'key> { /* private fields */ }Expand description
An entity for performing signing that is able to handle all supported target types.
Implementations§
source§impl<'key> UnifiedSigner<'key>
impl<'key> UnifiedSigner<'key>
sourcepub fn new(settings: SigningSettings<'key>) -> Self
pub fn new(settings: SigningSettings<'key>) -> Self
Construct a new instance bound to a SigningSettings.
Examples found in repository?
src/cli.rs (line 2255)
2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270
fn command_sign(args: &ArgMatches) -> Result<(), AppleCodesignError> {
let mut settings = SigningSettings::default();
let (private_keys, mut public_certificates) = collect_certificates_from_args(args, true)?;
if private_keys.len() > 1 {
error!("at most 1 PRIVATE KEY can be present; aborting");
return Err(AppleCodesignError::CliBadArgument);
}
let private = if private_keys.is_empty() {
None
} else {
Some(&private_keys[0])
};
if let Some(signing_key) = &private {
if public_certificates.is_empty() {
error!("a PRIVATE KEY requires a corresponding CERTIFICATE to pair with it");
return Err(AppleCodesignError::CliBadArgument);
}
let cert = public_certificates.remove(0);
warn!("registering signing key");
settings.set_signing_key(signing_key.as_key_info_signer(), cert);
if let Some(certs) = settings.chain_apple_certificates() {
for cert in certs {
warn!(
"automatically registered Apple CA certificate: {}",
cert.subject_common_name()
.unwrap_or_else(|| "default".into())
);
}
}
if let Some(timestamp_url) = args.get_one::<String>("timestamp_url") {
if timestamp_url != "none" {
warn!("using time-stamp protocol server {}", timestamp_url);
settings.set_time_stamp_url(timestamp_url)?;
}
}
}
if let Some(team_id) = settings.set_team_id_from_signing_certificate() {
warn!(
"automatically setting team ID from signing certificate: {}",
team_id
);
}
for cert in public_certificates {
warn!("registering extra X.509 certificate");
settings.chain_certificate(cert);
}
if let Some(team_name) = args.get_one::<String>("team_name") {
settings.set_team_id(team_name);
}
if let Some(value) = args.get_one::<String>("digest") {
let digest_type = DigestType::try_from(value.as_str())?;
settings.set_digest_type(digest_type);
}
if let Some(values) = args.get_many::<String>("extra_digest") {
for value in values {
let (scope, digest_type) = parse_scoped_value(value)?;
let digest_type = DigestType::try_from(digest_type)?;
settings.add_extra_digest(scope, digest_type);
}
}
if let Some(values) = args.get_many::<String>("exclude") {
for pattern in values {
settings.add_path_exclusion(pattern)?;
}
}
if let Some(values) = args.get_many::<String>("binary_identifier") {
for value in values {
let (scope, identifier) = parse_scoped_value(value)?;
settings.set_binary_identifier(scope, identifier);
}
}
if let Some(values) = args.get_many::<String>("code_requirements_path") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
let code_requirements_data = std::fs::read(path)?;
let reqs = CodeRequirements::parse_blob(&code_requirements_data)?.0;
for expr in reqs.iter() {
warn!(
"setting designated code requirements for {}: {}",
scope, expr
);
settings.set_designated_requirement_expression(scope.clone(), expr)?;
}
}
}
if let Some(values) = args.get_many::<String>("code_resources") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
warn!(
"setting code resources data for {} from path {}",
scope, path
);
let code_resources_data = std::fs::read(path)?;
settings.set_code_resources_data(scope, code_resources_data);
}
}
if let Some(values) = args.get_many::<String>("code_signature_flags_set") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let flags = CodeSignatureFlags::from_str(value)?;
settings.set_code_signature_flags(scope, flags);
}
}
if let Some(values) = args.get_many::<String>("entitlements_xml_path") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
warn!("setting entitlments XML for {} from path {}", scope, path);
let entitlements_data = std::fs::read_to_string(path)?;
settings.set_entitlements_xml(scope, entitlements_data)?;
}
}
if let Some(values) = args.get_many::<String>("runtime_version") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let version = semver::Version::parse(value)?;
settings.set_runtime_version(scope, version);
}
}
if let Some(values) = args.get_many::<String>("info_plist_path") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let content = std::fs::read(value)?;
settings.set_info_plist_data(scope, content);
}
}
let input_path = PathBuf::from(
args.get_one::<String>("input_path")
.expect("input_path presence should have been validated by clap"),
);
let output_path = args.get_one::<String>("output_path");
let signer = UnifiedSigner::new(settings);
if let Some(output_path) = output_path {
warn!("signing {} to {}", input_path.display(), output_path);
signer.sign_path(input_path, output_path)?;
} else {
warn!("signing {} in place", input_path.display());
signer.sign_path_in_place(input_path)?;
}
if let Some(private) = &private {
private.finish()?;
}
Ok(())
}sourcepub fn sign_path(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
pub fn sign_path(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
Signs input_path and writes the signed output to output_path.
Examples found in repository?
More examples
src/cli.rs (line 2259)
2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270
fn command_sign(args: &ArgMatches) -> Result<(), AppleCodesignError> {
let mut settings = SigningSettings::default();
let (private_keys, mut public_certificates) = collect_certificates_from_args(args, true)?;
if private_keys.len() > 1 {
error!("at most 1 PRIVATE KEY can be present; aborting");
return Err(AppleCodesignError::CliBadArgument);
}
let private = if private_keys.is_empty() {
None
} else {
Some(&private_keys[0])
};
if let Some(signing_key) = &private {
if public_certificates.is_empty() {
error!("a PRIVATE KEY requires a corresponding CERTIFICATE to pair with it");
return Err(AppleCodesignError::CliBadArgument);
}
let cert = public_certificates.remove(0);
warn!("registering signing key");
settings.set_signing_key(signing_key.as_key_info_signer(), cert);
if let Some(certs) = settings.chain_apple_certificates() {
for cert in certs {
warn!(
"automatically registered Apple CA certificate: {}",
cert.subject_common_name()
.unwrap_or_else(|| "default".into())
);
}
}
if let Some(timestamp_url) = args.get_one::<String>("timestamp_url") {
if timestamp_url != "none" {
warn!("using time-stamp protocol server {}", timestamp_url);
settings.set_time_stamp_url(timestamp_url)?;
}
}
}
if let Some(team_id) = settings.set_team_id_from_signing_certificate() {
warn!(
"automatically setting team ID from signing certificate: {}",
team_id
);
}
for cert in public_certificates {
warn!("registering extra X.509 certificate");
settings.chain_certificate(cert);
}
if let Some(team_name) = args.get_one::<String>("team_name") {
settings.set_team_id(team_name);
}
if let Some(value) = args.get_one::<String>("digest") {
let digest_type = DigestType::try_from(value.as_str())?;
settings.set_digest_type(digest_type);
}
if let Some(values) = args.get_many::<String>("extra_digest") {
for value in values {
let (scope, digest_type) = parse_scoped_value(value)?;
let digest_type = DigestType::try_from(digest_type)?;
settings.add_extra_digest(scope, digest_type);
}
}
if let Some(values) = args.get_many::<String>("exclude") {
for pattern in values {
settings.add_path_exclusion(pattern)?;
}
}
if let Some(values) = args.get_many::<String>("binary_identifier") {
for value in values {
let (scope, identifier) = parse_scoped_value(value)?;
settings.set_binary_identifier(scope, identifier);
}
}
if let Some(values) = args.get_many::<String>("code_requirements_path") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
let code_requirements_data = std::fs::read(path)?;
let reqs = CodeRequirements::parse_blob(&code_requirements_data)?.0;
for expr in reqs.iter() {
warn!(
"setting designated code requirements for {}: {}",
scope, expr
);
settings.set_designated_requirement_expression(scope.clone(), expr)?;
}
}
}
if let Some(values) = args.get_many::<String>("code_resources") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
warn!(
"setting code resources data for {} from path {}",
scope, path
);
let code_resources_data = std::fs::read(path)?;
settings.set_code_resources_data(scope, code_resources_data);
}
}
if let Some(values) = args.get_many::<String>("code_signature_flags_set") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let flags = CodeSignatureFlags::from_str(value)?;
settings.set_code_signature_flags(scope, flags);
}
}
if let Some(values) = args.get_many::<String>("entitlements_xml_path") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
warn!("setting entitlments XML for {} from path {}", scope, path);
let entitlements_data = std::fs::read_to_string(path)?;
settings.set_entitlements_xml(scope, entitlements_data)?;
}
}
if let Some(values) = args.get_many::<String>("runtime_version") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let version = semver::Version::parse(value)?;
settings.set_runtime_version(scope, version);
}
}
if let Some(values) = args.get_many::<String>("info_plist_path") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let content = std::fs::read(value)?;
settings.set_info_plist_data(scope, content);
}
}
let input_path = PathBuf::from(
args.get_one::<String>("input_path")
.expect("input_path presence should have been validated by clap"),
);
let output_path = args.get_one::<String>("output_path");
let signer = UnifiedSigner::new(settings);
if let Some(output_path) = output_path {
warn!("signing {} to {}", input_path.display(), output_path);
signer.sign_path(input_path, output_path)?;
} else {
warn!("signing {} in place", input_path.display());
signer.sign_path_in_place(input_path)?;
}
if let Some(private) = &private {
private.finish()?;
}
Ok(())
}sourcepub fn sign_path_in_place(
&self,
path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
pub fn sign_path_in_place(
&self,
path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
Sign a filesystem path in place.
This is just a convenience wrapper for Self::sign_path() with the same path passed to both the input and output path.
Examples found in repository?
src/cli.rs (line 2262)
2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270
fn command_sign(args: &ArgMatches) -> Result<(), AppleCodesignError> {
let mut settings = SigningSettings::default();
let (private_keys, mut public_certificates) = collect_certificates_from_args(args, true)?;
if private_keys.len() > 1 {
error!("at most 1 PRIVATE KEY can be present; aborting");
return Err(AppleCodesignError::CliBadArgument);
}
let private = if private_keys.is_empty() {
None
} else {
Some(&private_keys[0])
};
if let Some(signing_key) = &private {
if public_certificates.is_empty() {
error!("a PRIVATE KEY requires a corresponding CERTIFICATE to pair with it");
return Err(AppleCodesignError::CliBadArgument);
}
let cert = public_certificates.remove(0);
warn!("registering signing key");
settings.set_signing_key(signing_key.as_key_info_signer(), cert);
if let Some(certs) = settings.chain_apple_certificates() {
for cert in certs {
warn!(
"automatically registered Apple CA certificate: {}",
cert.subject_common_name()
.unwrap_or_else(|| "default".into())
);
}
}
if let Some(timestamp_url) = args.get_one::<String>("timestamp_url") {
if timestamp_url != "none" {
warn!("using time-stamp protocol server {}", timestamp_url);
settings.set_time_stamp_url(timestamp_url)?;
}
}
}
if let Some(team_id) = settings.set_team_id_from_signing_certificate() {
warn!(
"automatically setting team ID from signing certificate: {}",
team_id
);
}
for cert in public_certificates {
warn!("registering extra X.509 certificate");
settings.chain_certificate(cert);
}
if let Some(team_name) = args.get_one::<String>("team_name") {
settings.set_team_id(team_name);
}
if let Some(value) = args.get_one::<String>("digest") {
let digest_type = DigestType::try_from(value.as_str())?;
settings.set_digest_type(digest_type);
}
if let Some(values) = args.get_many::<String>("extra_digest") {
for value in values {
let (scope, digest_type) = parse_scoped_value(value)?;
let digest_type = DigestType::try_from(digest_type)?;
settings.add_extra_digest(scope, digest_type);
}
}
if let Some(values) = args.get_many::<String>("exclude") {
for pattern in values {
settings.add_path_exclusion(pattern)?;
}
}
if let Some(values) = args.get_many::<String>("binary_identifier") {
for value in values {
let (scope, identifier) = parse_scoped_value(value)?;
settings.set_binary_identifier(scope, identifier);
}
}
if let Some(values) = args.get_many::<String>("code_requirements_path") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
let code_requirements_data = std::fs::read(path)?;
let reqs = CodeRequirements::parse_blob(&code_requirements_data)?.0;
for expr in reqs.iter() {
warn!(
"setting designated code requirements for {}: {}",
scope, expr
);
settings.set_designated_requirement_expression(scope.clone(), expr)?;
}
}
}
if let Some(values) = args.get_many::<String>("code_resources") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
warn!(
"setting code resources data for {} from path {}",
scope, path
);
let code_resources_data = std::fs::read(path)?;
settings.set_code_resources_data(scope, code_resources_data);
}
}
if let Some(values) = args.get_many::<String>("code_signature_flags_set") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let flags = CodeSignatureFlags::from_str(value)?;
settings.set_code_signature_flags(scope, flags);
}
}
if let Some(values) = args.get_many::<String>("entitlements_xml_path") {
for value in values {
let (scope, path) = parse_scoped_value(value)?;
warn!("setting entitlments XML for {} from path {}", scope, path);
let entitlements_data = std::fs::read_to_string(path)?;
settings.set_entitlements_xml(scope, entitlements_data)?;
}
}
if let Some(values) = args.get_many::<String>("runtime_version") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let version = semver::Version::parse(value)?;
settings.set_runtime_version(scope, version);
}
}
if let Some(values) = args.get_many::<String>("info_plist_path") {
for value in values {
let (scope, value) = parse_scoped_value(value)?;
let content = std::fs::read(value)?;
settings.set_info_plist_data(scope, content);
}
}
let input_path = PathBuf::from(
args.get_one::<String>("input_path")
.expect("input_path presence should have been validated by clap"),
);
let output_path = args.get_one::<String>("output_path");
let signer = UnifiedSigner::new(settings);
if let Some(output_path) = output_path {
warn!("signing {} to {}", input_path.display(), output_path);
signer.sign_path(input_path, output_path)?;
} else {
warn!("signing {} in place", input_path.display());
signer.sign_path_in_place(input_path)?;
}
if let Some(private) = &private {
private.finish()?;
}
Ok(())
}sourcepub fn sign_macho(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
pub fn sign_macho(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
Sign a Mach-O binary.
Examples found in repository?
src/signing.rs (line 43)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
pub fn sign_path(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>,
) -> Result<(), AppleCodesignError> {
let input_path = input_path.as_ref();
match PathType::from_path(input_path)? {
PathType::Bundle => self.sign_bundle(input_path, output_path),
PathType::Dmg => self.sign_dmg(input_path, output_path),
PathType::MachO => self.sign_macho(input_path, output_path),
PathType::Xar => self.sign_xar(input_path, output_path),
PathType::Zip | PathType::Other => Err(AppleCodesignError::UnrecognizedPathType),
}
}sourcepub fn sign_dmg(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
pub fn sign_dmg(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
Sign a .dmg file.
Examples found in repository?
src/signing.rs (line 42)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
pub fn sign_path(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>,
) -> Result<(), AppleCodesignError> {
let input_path = input_path.as_ref();
match PathType::from_path(input_path)? {
PathType::Bundle => self.sign_bundle(input_path, output_path),
PathType::Dmg => self.sign_dmg(input_path, output_path),
PathType::MachO => self.sign_macho(input_path, output_path),
PathType::Xar => self.sign_xar(input_path, output_path),
PathType::Zip | PathType::Other => Err(AppleCodesignError::UnrecognizedPathType),
}
}sourcepub fn sign_bundle(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
pub fn sign_bundle(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
Sign a bundle.
Examples found in repository?
src/signing.rs (line 41)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
pub fn sign_path(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>,
) -> Result<(), AppleCodesignError> {
let input_path = input_path.as_ref();
match PathType::from_path(input_path)? {
PathType::Bundle => self.sign_bundle(input_path, output_path),
PathType::Dmg => self.sign_dmg(input_path, output_path),
PathType::MachO => self.sign_macho(input_path, output_path),
PathType::Xar => self.sign_xar(input_path, output_path),
PathType::Zip | PathType::Other => Err(AppleCodesignError::UnrecognizedPathType),
}
}sourcepub fn sign_xar(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
pub fn sign_xar(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>
) -> Result<(), AppleCodesignError>
Examples found in repository?
src/signing.rs (line 44)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
pub fn sign_path(
&self,
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>,
) -> Result<(), AppleCodesignError> {
let input_path = input_path.as_ref();
match PathType::from_path(input_path)? {
PathType::Bundle => self.sign_bundle(input_path, output_path),
PathType::Dmg => self.sign_dmg(input_path, output_path),
PathType::MachO => self.sign_macho(input_path, output_path),
PathType::Xar => self.sign_xar(input_path, output_path),
PathType::Zip | PathType::Other => Err(AppleCodesignError::UnrecognizedPathType),
}
}Auto Trait Implementations§
impl<'key> !RefUnwindSafe for UnifiedSigner<'key>
impl<'key> !Send for UnifiedSigner<'key>
impl<'key> !Sync for UnifiedSigner<'key>
impl<'key> Unpin for UnifiedSigner<'key>
impl<'key> !UnwindSafe for UnifiedSigner<'key>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows
self, then passes self.as_mut() into the pipe
function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Immutable access to the
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Immutable access to the
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Mutable access to the
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Calls
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.