Struct apple_codesign::ExecutableSegmentFlags
source · pub struct ExecutableSegmentFlags { /* private fields */ }
Expand description
Flags that influence behavior of executable segment.
Implementations§
source§impl ExecutableSegmentFlags
impl ExecutableSegmentFlags
sourcepub const MAIN_BINARY: Self = _
pub const MAIN_BINARY: Self = _
Executable segment belongs to main binary.
sourcepub const ALLOW_UNSIGNED: Self = _
pub const ALLOW_UNSIGNED: Self = _
Allow unsigned pages (for debugging).
sourcepub const SKIP_LIBRARY_VALIDATION: Self = _
pub const SKIP_LIBRARY_VALIDATION: Self = _
Skip library validation (obsolete).
sourcepub const CAN_LOAD_CD_HASH: Self = _
pub const CAN_LOAD_CD_HASH: Self = _
Can bless code directory hash for execution.
sourcepub const CAN_EXEC_CD_HASH: Self = _
pub const CAN_EXEC_CD_HASH: Self = _
Can execute blessed code directory hash.
sourcepub const fn empty() -> Self
pub const fn empty() -> Self
Returns an empty set of flags.
Examples found in repository?
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
pub fn plist_to_executable_segment_flags(value: &Value) -> ExecutableSegmentFlags {
let mut flags = ExecutableSegmentFlags::empty();
if let Value::Dictionary(d) = value {
if matches!(d.get("get-task-allow"), Some(Value::Boolean(true))) {
flags |= ExecutableSegmentFlags::ALLOW_UNSIGNED;
}
if matches!(d.get("run-unsigned-code"), Some(Value::Boolean(true))) {
flags |= ExecutableSegmentFlags::ALLOW_UNSIGNED;
}
if matches!(
d.get("com.apple.private.cs.debugger"),
Some(Value::Boolean(true))
) {
flags |= ExecutableSegmentFlags::DEBUGGER;
}
if matches!(d.get("dynamic-codesigning"), Some(Value::Boolean(true))) {
flags |= ExecutableSegmentFlags::JIT;
}
if matches!(
d.get("com.apple.private.skip-library-validation"),
Some(Value::Boolean(true))
) {
flags |= ExecutableSegmentFlags::SKIP_LIBRARY_VALIDATION;
}
if matches!(
d.get("com.apple.private.amfi.can-load-cdhash"),
Some(Value::Boolean(true))
) {
flags |= ExecutableSegmentFlags::CAN_LOAD_CD_HASH;
}
if matches!(
d.get("com.apple.private.amfi.can-execute-cdhash"),
Some(Value::Boolean(true))
) {
flags |= ExecutableSegmentFlags::CAN_EXEC_CD_HASH;
}
}
flags
}
sourcepub const fn from_bits(bits: u64) -> Option<Self>
pub const fn from_bits(bits: u64) -> Option<Self>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u64) -> Self
pub const fn from_bits_truncate(bits: u64) -> Self
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u64) -> Self
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
Examples found in repository?
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 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 408 409 410 411 412 413 414 415
fn from_blob_bytes(data: &'a [u8]) -> Result<Self, AppleCodesignError> {
read_and_validate_blob_header(data, Self::magic(), "code directory blob")?;
let offset = &mut 8;
let version = data.gread_with(offset, scroll::BE)?;
let flags = data.gread_with::<u32>(offset, scroll::BE)?;
let flags = unsafe { CodeSignatureFlags::from_bits_unchecked(flags) };
assert_eq!(*offset, 0x10);
let digest_offset = data.gread_with::<u32>(offset, scroll::BE)?;
let ident_offset = data.gread_with::<u32>(offset, scroll::BE)?;
let n_special_slots = data.gread_with::<u32>(offset, scroll::BE)?;
let n_code_slots = data.gread_with::<u32>(offset, scroll::BE)?;
assert_eq!(*offset, 0x20);
let code_limit = data.gread_with(offset, scroll::BE)?;
let digest_size = data.gread_with(offset, scroll::BE)?;
let digest_type = data.gread_with::<u8>(offset, scroll::BE)?.into();
let platform = data.gread_with(offset, scroll::BE)?;
let page_size = data.gread_with::<u8>(offset, scroll::BE)?;
let page_size = 2u32.pow(page_size as u32);
let spare2 = data.gread_with(offset, scroll::BE)?;
let scatter_offset = if version >= CodeDirectoryVersion::SupportsScatter as u32 {
let v = data.gread_with(offset, scroll::BE)?;
if v != 0 {
Some(v)
} else {
None
}
} else {
None
};
let team_offset = if version >= CodeDirectoryVersion::SupportsTeamId as u32 {
assert_eq!(*offset, 0x30);
let v = data.gread_with::<u32>(offset, scroll::BE)?;
if v != 0 {
Some(v)
} else {
None
}
} else {
None
};
let (spare3, code_limit_64) = if version >= CodeDirectoryVersion::SupportsCodeLimit64 as u32
{
(
Some(data.gread_with(offset, scroll::BE)?),
Some(data.gread_with(offset, scroll::BE)?),
)
} else {
(None, None)
};
let (exec_seg_base, exec_seg_limit, exec_seg_flags) =
if version >= CodeDirectoryVersion::SupportsExecutableSegment as u32 {
assert_eq!(*offset, 0x40);
(
Some(data.gread_with(offset, scroll::BE)?),
Some(data.gread_with(offset, scroll::BE)?),
Some(data.gread_with::<u64>(offset, scroll::BE)?),
)
} else {
(None, None, None)
};
let exec_seg_flags = exec_seg_flags
.map(|flags| unsafe { ExecutableSegmentFlags::from_bits_unchecked(flags) });
let (runtime, pre_encrypt_offset) =
if version >= CodeDirectoryVersion::SupportsRuntime as u32 {
assert_eq!(*offset, 0x58);
(
Some(data.gread_with(offset, scroll::BE)?),
Some(data.gread_with(offset, scroll::BE)?),
)
} else {
(None, None)
};
let (linkage_hash_type, linkage_truncated, spare4, linkage_offset, linkage_size) =
if version >= CodeDirectoryVersion::SupportsLinkage as u32 {
assert_eq!(*offset, 0x60);
(
Some(data.gread_with(offset, scroll::BE)?),
Some(data.gread_with(offset, scroll::BE)?),
Some(data.gread_with(offset, scroll::BE)?),
Some(data.gread_with(offset, scroll::BE)?),
Some(data.gread_with(offset, scroll::BE)?),
)
} else {
(None, None, None, None, None)
};
// Find trailing null in identifier string.
let ident = match data[ident_offset as usize..]
.split(|&b| b == 0)
.map(std::str::from_utf8)
.next()
{
Some(res) => {
Cow::from(res.map_err(|_| AppleCodesignError::CodeDirectoryMalformedIdentifier)?)
}
None => {
return Err(AppleCodesignError::CodeDirectoryMalformedIdentifier);
}
};
let team_name = if let Some(team_offset) = team_offset {
match data[team_offset as usize..]
.split(|&b| b == 0)
.map(std::str::from_utf8)
.next()
{
Some(res) => {
Some(Cow::from(res.map_err(|_| {
AppleCodesignError::CodeDirectoryMalformedTeam
})?))
}
None => {
return Err(AppleCodesignError::CodeDirectoryMalformedTeam);
}
}
} else {
None
};
let code_digests = get_hashes(
data,
digest_offset as usize,
n_code_slots as usize,
digest_size as usize,
);
let special_digests = get_hashes(
data,
(digest_offset - (digest_size as u32 * n_special_slots)) as usize,
n_special_slots as usize,
digest_size as usize,
)
.into_iter()
.enumerate()
.map(|(i, h)| (CodeSigningSlot::from(n_special_slots - i as u32), h))
.collect();
Ok(Self {
version,
flags,
code_limit,
digest_size,
digest_type,
platform,
page_size,
spare2,
scatter_offset,
spare3,
code_limit_64,
exec_seg_base,
exec_seg_limit,
exec_seg_flags,
runtime,
pre_encrypt_offset,
linkage_hash_type,
linkage_truncated,
spare4,
linkage_offset,
linkage_size,
ident,
team_name,
code_digests,
special_digests,
})
}
sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Returns true
if no flags are currently stored.
Examples found in repository?
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
pub fn create_code_directory(
&self,
settings: &SigningSettings,
macho: &MachOBinary,
) -> Result<CodeDirectoryBlob<'static>, AppleCodesignError> {
// TODO support defining or filling in proper values for fields with
// static values.
let target = macho.find_targeting()?;
if let Some(target) = &target {
info!(
"binary targets {} >= {} with SDK {}",
target.platform, target.minimum_os_version, target.sdk_version,
);
}
let mut flags = CodeSignatureFlags::empty();
if let Some(additional) = settings.code_signature_flags(SettingsScope::Main) {
info!(
"adding code signature flags from signing settings: {:?}",
additional
);
flags |= additional;
}
// The adhoc flag is set when there is no CMS signature.
if settings.signing_key().is_none() {
info!("creating ad-hoc signature");
flags |= CodeSignatureFlags::ADHOC;
} else if flags.contains(CodeSignatureFlags::ADHOC) {
info!("removing ad-hoc code signature flag");
flags -= CodeSignatureFlags::ADHOC;
}
// Remove linker signed flag because we're not a linker.
if flags.contains(CodeSignatureFlags::LINKER_SIGNED) {
info!("removing linker signed flag from code signature (we're not a linker)");
flags -= CodeSignatureFlags::LINKER_SIGNED;
}
// Code limit fields hold the file offset at which code digests stop. This
// is the file offset in the `__LINKEDIT` segment when the embedded signature
// SuperBlob begins.
let (code_limit, code_limit_64) = match macho.code_limit_binary_offset()? {
x if x > u32::MAX as u64 => (0, Some(x)),
x => (x as u32, None),
};
let platform = 0;
let page_size = 4096u32;
let (exec_seg_base, exec_seg_limit) = macho.executable_segment_boundary()?;
let (exec_seg_base, exec_seg_limit) = (Some(exec_seg_base), Some(exec_seg_limit));
// Executable segment flags are wonky.
//
// Foremost, these flags are only present if the Mach-O binary is an executable. So not
// matter what the settings say, we don't set these flags unless the Mach-O file type
// is proper.
//
// Executable segment flags are also derived from an associated entitlements plist.
let exec_seg_flags = if macho.is_executable() {
if let Some(entitlements) = settings.entitlements_plist(SettingsScope::Main) {
let flags = plist_to_executable_segment_flags(entitlements);
if !flags.is_empty() {
info!("entitlements imply executable segment flags: {:?}", flags);
}
Some(flags | ExecutableSegmentFlags::MAIN_BINARY)
} else {
Some(ExecutableSegmentFlags::MAIN_BINARY)
}
} else {
None
};
// The runtime version is the SDK version from the targeting loader commands. Same
// u32 with nibbles encoding the version.
//
// If the runtime code signature flag is set, we also need to set the runtime version
// or else the activation of the hardened runtime is incomplete.
// If the settings defines a runtime version override, use it.
let runtime = match settings.runtime_version(SettingsScope::Main) {
Some(version) => {
info!(
"using hardened runtime version {} from signing settings",
version
);
Some(semver_to_macho_target_version(version))
}
None => None,
};
// If we still don't have a runtime but need one, derive from the target SDK.
let runtime = if runtime.is_none() && flags.contains(CodeSignatureFlags::RUNTIME) {
if let Some(target) = &target {
info!(
"using hardened runtime version {} derived from SDK version",
target.sdk_version
);
Some(semver_to_macho_target_version(&target.sdk_version))
} else {
warn!("hardened runtime version required but unable to derive suitable version; signature will likely fail Apple checks");
None
}
} else {
runtime
};
let code_hashes = macho
.code_digests(*settings.digest_type(), page_size as _)?
.into_iter()
.map(|v| Digest { data: v.into() })
.collect::<Vec<_>>();
let mut special_hashes = HashMap::new();
// There is no corresponding blob for the info plist data since it is provided
// externally to the embedded signature.
if let Some(data) = settings.info_plist_data(SettingsScope::Main) {
special_hashes.insert(
CodeSigningSlot::Info,
Digest {
data: settings.digest_type().digest_data(data)?.into(),
},
);
}
// There is no corresponding blob for resources data since it is provided
// externally to the embedded signature.
if let Some(data) = settings.code_resources_data(SettingsScope::Main) {
special_hashes.insert(
CodeSigningSlot::ResourceDir,
Digest {
data: settings.digest_type().digest_data(data)?.into(),
}
.to_owned(),
);
}
let ident = Cow::Owned(
settings
.binary_identifier(SettingsScope::Main)
.ok_or(AppleCodesignError::NoIdentifier)?
.to_string(),
);
let team_name = settings.team_id().map(|x| Cow::Owned(x.to_string()));
let mut cd = CodeDirectoryBlob {
flags,
code_limit,
digest_size: settings.digest_type().hash_len()? as u8,
digest_type: *settings.digest_type(),
platform,
page_size,
code_limit_64,
exec_seg_base,
exec_seg_limit,
exec_seg_flags,
runtime,
ident,
team_name,
code_digests: code_hashes,
..Default::default()
};
for (slot, digest) in special_hashes {
cd.set_slot_digest(slot, digest)?;
}
cd.adjust_version(target);
cd.clear_newer_fields();
Ok(cd)
}
sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations§
source§impl Binary for ExecutableSegmentFlags
impl Binary for ExecutableSegmentFlags
source§impl BitAndAssign<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl BitAndAssign<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Disables all flags disabled in the set.
source§impl BitOr<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl BitOr<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn bitor(self, other: ExecutableSegmentFlags) -> Self
fn bitor(self, other: ExecutableSegmentFlags) -> Self
Returns the union of the two sets of flags.
§type Output = ExecutableSegmentFlags
type Output = ExecutableSegmentFlags
|
operator.source§impl BitOrAssign<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl BitOrAssign<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Adds the set of flags.
source§impl BitXorAssign<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl BitXorAssign<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Toggles the set of flags.
source§impl Clone for ExecutableSegmentFlags
impl Clone for ExecutableSegmentFlags
source§fn clone(&self) -> ExecutableSegmentFlags
fn clone(&self) -> ExecutableSegmentFlags
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ExecutableSegmentFlags
impl Debug for ExecutableSegmentFlags
source§impl Default for ExecutableSegmentFlags
impl Default for ExecutableSegmentFlags
source§fn default() -> ExecutableSegmentFlags
fn default() -> ExecutableSegmentFlags
source§impl Extend<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl Extend<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl FromIterator<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl FromIterator<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
source§impl FromStr for ExecutableSegmentFlags
impl FromStr for ExecutableSegmentFlags
source§impl Hash for ExecutableSegmentFlags
impl Hash for ExecutableSegmentFlags
source§impl LowerHex for ExecutableSegmentFlags
impl LowerHex for ExecutableSegmentFlags
source§impl Not for ExecutableSegmentFlags
impl Not for ExecutableSegmentFlags
source§impl Octal for ExecutableSegmentFlags
impl Octal for ExecutableSegmentFlags
source§impl Ord for ExecutableSegmentFlags
impl Ord for ExecutableSegmentFlags
source§fn cmp(&self, other: &ExecutableSegmentFlags) -> Ordering
fn cmp(&self, other: &ExecutableSegmentFlags) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl PartialEq<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn eq(&self, other: &ExecutableSegmentFlags) -> bool
fn eq(&self, other: &ExecutableSegmentFlags) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl PartialOrd<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn partial_cmp(&self, other: &ExecutableSegmentFlags) -> Option<Ordering>
fn partial_cmp(&self, other: &ExecutableSegmentFlags) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl SubAssign<ExecutableSegmentFlags> for ExecutableSegmentFlags
impl SubAssign<ExecutableSegmentFlags> for ExecutableSegmentFlags
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Disables all flags enabled in the set.
source§impl UpperHex for ExecutableSegmentFlags
impl UpperHex for ExecutableSegmentFlags
impl Copy for ExecutableSegmentFlags
impl Eq for ExecutableSegmentFlags
impl StructuralEq for ExecutableSegmentFlags
impl StructuralPartialEq for ExecutableSegmentFlags
Auto Trait Implementations§
impl RefUnwindSafe for ExecutableSegmentFlags
impl Send for ExecutableSegmentFlags
impl Sync for ExecutableSegmentFlags
impl Unpin for ExecutableSegmentFlags
impl UnwindSafe for ExecutableSegmentFlags
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
§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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
.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
.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,
.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,
.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,
.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,
.tap_ref_mut()
only in debug builds, and is erased in release
builds.