#[non_exhaustive]pub enum WriteError {
Invalid(ModelError),
ReservedSectionName {
section: SectionId,
},
SegmentsSharePage {
first: SectionId,
second: SectionId,
},
NoRoomForHeaders,
Unsupported {
what: &'static str,
},
TooLarge,
}Expand description
Why an object could not be written.
The enum is #[non_exhaustive]: match it with a wildcard arm.
§Examples
use object_lang::{Architecture, Object, Section, SectionKind, WriteError};
let mut obj = Object::relocatable(Architecture::X86_64);
let note = obj.add_section(Section::new(".note.GNU-stack", SectionKind::Other));
assert_eq!(
object_lang::elf::write(&obj),
Err(WriteError::ReservedSectionName { section: note }),
);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Invalid(ModelError)
The object breaks a rule of the model.
ReservedSectionName
A section uses a name the writer generates itself (ELF: .note.GNU-stack in a
relocatable object, which records executable_stack).
Two loadable sections of an executable with different permissions, or a BSS section followed by initialized data, share a page. Each permission change must start on a fresh page.
NoRoomForHeaders
An executable’s lowest section is too close to address zero to map the file headers on the pages below it.
Unsupported
The object uses something this writer does not support yet; the message says what.
TooLarge
The file would exceed the format’s size limits or the address space.
Trait Implementations§
Source§impl Clone for WriteError
impl Clone for WriteError
impl Copy for WriteError
Source§impl Debug for WriteError
impl Debug for WriteError
Source§impl Display for WriteError
impl Display for WriteError
impl Eq for WriteError
Source§impl Error for WriteError
impl Error for WriteError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<ModelError> for WriteError
impl From<ModelError> for WriteError
Source§fn from(err: ModelError) -> Self
fn from(err: ModelError) -> Self
Converts to this type from the input type.
Source§impl Hash for WriteError
impl Hash for WriteError
Source§impl PartialEq for WriteError
impl PartialEq for WriteError
impl StructuralPartialEq for WriteError
Auto Trait Implementations§
impl Freeze for WriteError
impl RefUnwindSafe for WriteError
impl Send for WriteError
impl Sync for WriteError
impl Unpin for WriteError
impl UnsafeUnpin for WriteError
impl UnwindSafe for WriteError
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