pub struct SectionFlags(/* private fields */);Expand description
Attributes of a section, independent of the file format.
A small bit set: combine flags with |, test them with
contains. Which combinations a section may carry depends
on its SectionKind.
§Examples
use object_lang::SectionFlags;
let flags = SectionFlags::ALLOC | SectionFlags::MERGE | SectionFlags::STRINGS;
assert!(flags.contains(SectionFlags::MERGE));
assert!(!flags.contains(SectionFlags::WRITE));Implementations§
Source§impl SectionFlags
impl SectionFlags
Sourcepub const ALLOC: SectionFlags
pub const ALLOC: SectionFlags
The section occupies memory when the program runs.
Sourcepub const WRITE: SectionFlags
pub const WRITE: SectionFlags
The section is writable at run time.
Sourcepub const EXEC: SectionFlags
pub const EXEC: SectionFlags
The section holds executable instructions.
Sourcepub const TLS: SectionFlags
pub const TLS: SectionFlags
The section is a thread-local storage template (.tdata, .tbss).
Sourcepub const MERGE: SectionFlags
pub const MERGE: SectionFlags
Equal entries of entry_size bytes may be merged by the
linker. Requires a non-zero entry size.
Sourcepub const STRINGS: SectionFlags
pub const STRINGS: SectionFlags
The entries are NUL-terminated strings (with MERGE,
equal strings may be merged).
Sourcepub const fn contains(self, other: SectionFlags) -> bool
pub const fn contains(self, other: SectionFlags) -> bool
Whether every flag in other is set in self.
§Examples
use object_lang::SectionFlags;
let rw = SectionFlags::ALLOC | SectionFlags::WRITE;
assert!(rw.contains(SectionFlags::WRITE));
assert!(!rw.contains(SectionFlags::WRITE | SectionFlags::EXEC));Sourcepub const fn is_empty(self) -> bool
pub const fn is_empty(self) -> bool
Whether no flag is set.
§Examples
use object_lang::SectionFlags;
assert!(!SectionFlags::ALLOC.is_empty());Sourcepub const fn union(self, other: SectionFlags) -> Self
pub const fn union(self, other: SectionFlags) -> Self
self with every flag of other added.
§Examples
use object_lang::SectionFlags;
assert_eq!(SectionFlags::ALLOC.union(SectionFlags::WRITE), SectionFlags::ALLOC | SectionFlags::WRITE);Sourcepub const fn difference(self, other: SectionFlags) -> Self
pub const fn difference(self, other: SectionFlags) -> Self
self with every flag of other removed.
§Examples
use object_lang::SectionFlags;
let rw = SectionFlags::ALLOC | SectionFlags::WRITE;
assert_eq!(rw.difference(SectionFlags::WRITE), SectionFlags::ALLOC);Trait Implementations§
Source§impl BitOr for SectionFlags
impl BitOr for SectionFlags
Source§type Output = SectionFlags
type Output = SectionFlags
The resulting type after applying the
| operator.Source§fn bitor(self, rhs: SectionFlags) -> SectionFlags
fn bitor(self, rhs: SectionFlags) -> SectionFlags
Performs the
| operation. Read moreSource§impl BitOrAssign for SectionFlags
impl BitOrAssign for SectionFlags
Source§fn bitor_assign(&mut self, rhs: SectionFlags)
fn bitor_assign(&mut self, rhs: SectionFlags)
Performs the
|= operation. Read moreSource§impl Clone for SectionFlags
impl Clone for SectionFlags
impl Copy for SectionFlags
Source§impl Debug for SectionFlags
impl Debug for SectionFlags
Source§impl Default for SectionFlags
impl Default for SectionFlags
impl Eq for SectionFlags
Source§impl Hash for SectionFlags
impl Hash for SectionFlags
Source§impl PartialEq for SectionFlags
impl PartialEq for SectionFlags
impl StructuralPartialEq for SectionFlags
Auto Trait Implementations§
impl Freeze for SectionFlags
impl RefUnwindSafe for SectionFlags
impl Send for SectionFlags
impl Sync for SectionFlags
impl Unpin for SectionFlags
impl UnsafeUnpin for SectionFlags
impl UnwindSafe for SectionFlags
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more