Struct apple_codesign::dmg::DmgReader
source · pub struct DmgReader { /* private fields */ }
Expand description
An entity for reading DMG files.
It only implements enough to create code signatures over the DMG.
Implementations§
source§impl DmgReader
impl DmgReader
sourcepub fn new<R: Read + Seek>(reader: &mut R) -> Result<Self, AppleCodesignError>
pub fn new<R: Read + Seek>(reader: &mut R) -> Result<Self, AppleCodesignError>
Construct a new instance from a reader.
Examples found in repository?
src/dmg.rs (line 272)
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
pub fn sign_file(
&self,
settings: &SigningSettings,
fh: &mut File,
) -> Result<(), AppleCodesignError> {
warn!("signing DMG");
let koly = DmgReader::new(fh)?.koly().clone();
let signature = self.create_superblob(settings, fh)?;
Self::write_embedded_signature(fh, koly, &signature)
}
/// Staple a notarization ticket to a DMG.
pub fn staple_file(
&self,
fh: &mut File,
ticket_data: Vec<u8>,
) -> Result<(), AppleCodesignError> {
warn!(
"stapling DMG with {} byte notarization ticket",
ticket_data.len()
);
let reader = DmgReader::new(fh)?;
let koly = reader.koly().clone();
let signature = reader
.embedded_signature()?
.ok_or(AppleCodesignError::DmgStapleNoSignature)?;
let mut builder = EmbeddedSignatureBuilder::new_for_stapling(signature)?;
builder.add_notarization_ticket(ticket_data)?;
let signature = builder.create_superblob()?;
Self::write_embedded_signature(fh, koly, &signature)
}
fn write_embedded_signature(
fh: &mut File,
mut koly: KolyTrailer,
signature: &[u8],
) -> Result<(), AppleCodesignError> {
warn!("writing {} byte signature", signature.len());
fh.seek(SeekFrom::Start(koly.offset_after_plist()))?;
fh.write_all(signature)?;
koly.code_signature_offset = koly.offset_after_plist();
koly.code_signature_size = signature.len() as _;
let mut trailer = [0u8; KOLY_SIZE as usize];
trailer.pwrite_with(&koly, 0, scroll::BE)?;
fh.write_all(&trailer)?;
fh.set_len(koly.code_signature_offset + koly.code_signature_size + KOLY_SIZE as u64)?;
Ok(())
}
/// Create the embedded signature superblob content.
pub fn create_superblob<F: Read + Write + Seek>(
&self,
settings: &SigningSettings,
fh: &mut F,
) -> Result<Vec<u8>, AppleCodesignError> {
let mut builder = EmbeddedSignatureBuilder::default();
for (slot, blob) in self.create_special_blobs()? {
builder.add_blob(slot, blob)?;
}
builder.add_code_directory(
CodeSigningSlot::CodeDirectory,
self.create_code_directory(settings, fh)?,
)?;
if let Some((signing_key, signing_cert)) = settings.signing_key() {
builder.create_cms_signature(
signing_key,
signing_cert,
settings.time_stamp_url(),
settings.certificate_chain().iter().cloned(),
)?;
}
builder.create_superblob()
}
/// Create the code directory data structure that is part of the embedded signature.
///
/// This won't be the final data structure state that is serialized, as it may be
/// amended to in other functions.
pub fn create_code_directory<F: Read + Write + Seek>(
&self,
settings: &SigningSettings,
fh: &mut F,
) -> Result<CodeDirectoryBlob<'static>, AppleCodesignError> {
let reader = DmgReader::new(fh)?;
let mut flags = settings
.code_signature_flags(SettingsScope::Main)
.unwrap_or_else(CodeSignatureFlags::empty);
if settings.signing_key().is_some() {
flags -= CodeSignatureFlags::ADHOC;
} else {
flags |= CodeSignatureFlags::ADHOC;
}
warn!("using code signature flags: {:?}", flags);
let ident = Cow::Owned(
settings
.binary_identifier(SettingsScope::Main)
.ok_or(AppleCodesignError::NoIdentifier)?
.to_string(),
);
warn!("using identifier {}", ident);
let code_hashes = vec![reader.digest_content_with(*settings.digest_type(), fh)?];
let koly_digest = reader
.koly()
.digest_for_code_directory(*settings.digest_type())?;
let mut cd = CodeDirectoryBlob {
version: 0x20100,
flags,
code_limit: reader.koly().offset_after_plist() as u32,
digest_size: settings.digest_type().hash_len()? as u8,
digest_type: *settings.digest_type(),
page_size: 1,
ident,
code_digests: code_hashes,
..Default::default()
};
cd.set_slot_digest(CodeSigningSlot::RepSpecific, koly_digest)?;
Ok(cd)
}
More examples
src/stapling.rs (line 218)
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
pub fn staple_dmg(&self, path: &Path) -> Result<(), AppleCodesignError> {
let mut fh = File::options().read(true).write(true).open(path)?;
warn!(
"attempting to find notarization ticket for DMG at {}",
path.display()
);
let reader = DmgReader::new(&mut fh)?;
let ticket_data = self.lookup_ticket_for_dmg(&reader)?;
warn!("found notarization ticket; proceeding with stapling");
let signer = DmgSigner::default();
signer.staple_file(&mut fh, ticket_data)?;
Ok(())
}
src/reader.rs (line 821)
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833
pub fn from_path(path: impl AsRef<Path>) -> Result<Self, AppleCodesignError> {
let path = path.as_ref();
match PathType::from_path(path)? {
PathType::Bundle => Ok(Self::Bundle(Box::new(
DirectoryBundle::new_from_path(path)
.map_err(AppleCodesignError::DirectoryBundle)?,
))),
PathType::Dmg => {
let mut fh = File::open(path)?;
Ok(Self::Dmg(
path.to_path_buf(),
Box::new(DmgReader::new(&mut fh)?),
))
}
PathType::MachO => {
let data = std::fs::read(path)?;
MachFile::parse(&data)?;
Ok(Self::MachO(path.to_path_buf(), data))
}
PathType::Xar => Ok(Self::FlatPackage(path.to_path_buf())),
PathType::Zip | PathType::Other => Err(AppleCodesignError::UnrecognizedPathType),
}
}
sourcepub fn koly(&self) -> &KolyTrailer
pub fn koly(&self) -> &KolyTrailer
Obtain the main data structure describing this DMG.
Examples found in repository?
src/dmg.rs (line 272)
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
pub fn sign_file(
&self,
settings: &SigningSettings,
fh: &mut File,
) -> Result<(), AppleCodesignError> {
warn!("signing DMG");
let koly = DmgReader::new(fh)?.koly().clone();
let signature = self.create_superblob(settings, fh)?;
Self::write_embedded_signature(fh, koly, &signature)
}
/// Staple a notarization ticket to a DMG.
pub fn staple_file(
&self,
fh: &mut File,
ticket_data: Vec<u8>,
) -> Result<(), AppleCodesignError> {
warn!(
"stapling DMG with {} byte notarization ticket",
ticket_data.len()
);
let reader = DmgReader::new(fh)?;
let koly = reader.koly().clone();
let signature = reader
.embedded_signature()?
.ok_or(AppleCodesignError::DmgStapleNoSignature)?;
let mut builder = EmbeddedSignatureBuilder::new_for_stapling(signature)?;
builder.add_notarization_ticket(ticket_data)?;
let signature = builder.create_superblob()?;
Self::write_embedded_signature(fh, koly, &signature)
}
fn write_embedded_signature(
fh: &mut File,
mut koly: KolyTrailer,
signature: &[u8],
) -> Result<(), AppleCodesignError> {
warn!("writing {} byte signature", signature.len());
fh.seek(SeekFrom::Start(koly.offset_after_plist()))?;
fh.write_all(signature)?;
koly.code_signature_offset = koly.offset_after_plist();
koly.code_signature_size = signature.len() as _;
let mut trailer = [0u8; KOLY_SIZE as usize];
trailer.pwrite_with(&koly, 0, scroll::BE)?;
fh.write_all(&trailer)?;
fh.set_len(koly.code_signature_offset + koly.code_signature_size + KOLY_SIZE as u64)?;
Ok(())
}
/// Create the embedded signature superblob content.
pub fn create_superblob<F: Read + Write + Seek>(
&self,
settings: &SigningSettings,
fh: &mut F,
) -> Result<Vec<u8>, AppleCodesignError> {
let mut builder = EmbeddedSignatureBuilder::default();
for (slot, blob) in self.create_special_blobs()? {
builder.add_blob(slot, blob)?;
}
builder.add_code_directory(
CodeSigningSlot::CodeDirectory,
self.create_code_directory(settings, fh)?,
)?;
if let Some((signing_key, signing_cert)) = settings.signing_key() {
builder.create_cms_signature(
signing_key,
signing_cert,
settings.time_stamp_url(),
settings.certificate_chain().iter().cloned(),
)?;
}
builder.create_superblob()
}
/// Create the code directory data structure that is part of the embedded signature.
///
/// This won't be the final data structure state that is serialized, as it may be
/// amended to in other functions.
pub fn create_code_directory<F: Read + Write + Seek>(
&self,
settings: &SigningSettings,
fh: &mut F,
) -> Result<CodeDirectoryBlob<'static>, AppleCodesignError> {
let reader = DmgReader::new(fh)?;
let mut flags = settings
.code_signature_flags(SettingsScope::Main)
.unwrap_or_else(CodeSignatureFlags::empty);
if settings.signing_key().is_some() {
flags -= CodeSignatureFlags::ADHOC;
} else {
flags |= CodeSignatureFlags::ADHOC;
}
warn!("using code signature flags: {:?}", flags);
let ident = Cow::Owned(
settings
.binary_identifier(SettingsScope::Main)
.ok_or(AppleCodesignError::NoIdentifier)?
.to_string(),
);
warn!("using identifier {}", ident);
let code_hashes = vec![reader.digest_content_with(*settings.digest_type(), fh)?];
let koly_digest = reader
.koly()
.digest_for_code_directory(*settings.digest_type())?;
let mut cd = CodeDirectoryBlob {
version: 0x20100,
flags,
code_limit: reader.koly().offset_after_plist() as u32,
digest_size: settings.digest_type().hash_len()? as u8,
digest_type: *settings.digest_type(),
page_size: 1,
ident,
code_digests: code_hashes,
..Default::default()
};
cd.set_slot_digest(CodeSigningSlot::RepSpecific, koly_digest)?;
Ok(cd)
}
More examples
src/reader.rs (line 858)
850 851 852 853 854 855 856 857 858 859 860 861 862
fn resolve_dmg_entity(dmg: &DmgReader) -> Result<DmgEntity, AppleCodesignError> {
let signature = if let Some(sig) = dmg.embedded_signature()? {
Some(sig.try_into()?)
} else {
None
};
Ok(DmgEntity {
code_signature_offset: dmg.koly().code_signature_offset,
code_signature_size: dmg.koly().code_signature_size,
signature,
})
}
sourcepub fn embedded_signature(
&self
) -> Result<Option<EmbeddedSignature<'_>>, AppleCodesignError>
pub fn embedded_signature(
&self
) -> Result<Option<EmbeddedSignature<'_>>, AppleCodesignError>
Obtain the embedded code signature superblob.
Examples found in repository?
src/reader.rs (line 851)
850 851 852 853 854 855 856 857 858 859 860 861 862
fn resolve_dmg_entity(dmg: &DmgReader) -> Result<DmgEntity, AppleCodesignError> {
let signature = if let Some(sig) = dmg.embedded_signature()? {
Some(sig.try_into()?)
} else {
None
};
Ok(DmgEntity {
code_signature_offset: dmg.koly().code_signature_offset,
code_signature_size: dmg.koly().code_signature_size,
signature,
})
}
More examples
src/dmg.rs (line 292)
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
pub fn staple_file(
&self,
fh: &mut File,
ticket_data: Vec<u8>,
) -> Result<(), AppleCodesignError> {
warn!(
"stapling DMG with {} byte notarization ticket",
ticket_data.len()
);
let reader = DmgReader::new(fh)?;
let koly = reader.koly().clone();
let signature = reader
.embedded_signature()?
.ok_or(AppleCodesignError::DmgStapleNoSignature)?;
let mut builder = EmbeddedSignatureBuilder::new_for_stapling(signature)?;
builder.add_notarization_ticket(ticket_data)?;
let signature = builder.create_superblob()?;
Self::write_embedded_signature(fh, koly, &signature)
}
src/stapling.rs (line 191)
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
pub fn lookup_ticket_for_dmg(&self, dmg: &DmgReader) -> Result<Vec<u8>, AppleCodesignError> {
// The ticket is derived from the code directory digest from the signature in the
// DMG.
let signature = dmg
.embedded_signature()?
.ok_or(AppleCodesignError::DmgStapleNoSignature)?;
let cd = signature
.code_directory()?
.ok_or(AppleCodesignError::DmgStapleNoSignature)?;
let mut digest = cd.digest_with(cd.digest_type)?;
digest.truncate(20);
let digest = hex::encode(digest);
let digest_type: u8 = cd.digest_type.into();
let record_name = format!("2/{digest_type}/{digest}");
let response = lookup_notarization_ticket(&self.client, &record_name)?;
response.signed_ticket(&record_name)
}
sourcepub fn digest_content_with<R: Read + Seek>(
&self,
digest: DigestType,
reader: &mut R
) -> Result<Digest<'static>, AppleCodesignError>
pub fn digest_content_with<R: Read + Seek>(
&self,
digest: DigestType,
reader: &mut R
) -> Result<Digest<'static>, AppleCodesignError>
Digest the content of the DMG up to the code signature or KolyTrailer.
This digest is used as the code digest in the code directory.
Examples found in repository?
src/dmg.rs (line 386)
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
pub fn create_code_directory<F: Read + Write + Seek>(
&self,
settings: &SigningSettings,
fh: &mut F,
) -> Result<CodeDirectoryBlob<'static>, AppleCodesignError> {
let reader = DmgReader::new(fh)?;
let mut flags = settings
.code_signature_flags(SettingsScope::Main)
.unwrap_or_else(CodeSignatureFlags::empty);
if settings.signing_key().is_some() {
flags -= CodeSignatureFlags::ADHOC;
} else {
flags |= CodeSignatureFlags::ADHOC;
}
warn!("using code signature flags: {:?}", flags);
let ident = Cow::Owned(
settings
.binary_identifier(SettingsScope::Main)
.ok_or(AppleCodesignError::NoIdentifier)?
.to_string(),
);
warn!("using identifier {}", ident);
let code_hashes = vec![reader.digest_content_with(*settings.digest_type(), fh)?];
let koly_digest = reader
.koly()
.digest_for_code_directory(*settings.digest_type())?;
let mut cd = CodeDirectoryBlob {
version: 0x20100,
flags,
code_limit: reader.koly().offset_after_plist() as u32,
digest_size: settings.digest_type().hash_len()? as u8,
digest_type: *settings.digest_type(),
page_size: 1,
ident,
code_digests: code_hashes,
..Default::default()
};
cd.set_slot_digest(CodeSigningSlot::RepSpecific, koly_digest)?;
Ok(cd)
}
Auto Trait Implementations§
impl RefUnwindSafe for DmgReader
impl Send for DmgReader
impl Sync for DmgReader
impl Unpin for DmgReader
impl UnwindSafe for DmgReader
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.