pub struct LinkageBuilder { /* private fields */ }Implementations§
Source§impl LinkageBuilder
impl LinkageBuilder
Sourcepub fn with_specifier(
&mut self,
specifier: impl Into<LinkageSpecifier>,
) -> &mut Self
pub fn with_specifier( &mut self, specifier: impl Into<LinkageSpecifier>, ) -> &mut Self
Add a specifier to the linkage, panicking if already specified.
§Panics
If the specifier conflicts with an already existing specifier, this will panic.
If this is not desired,
use Self::with_specifier_replacing or Self::try_with_specifier.
Sourcepub fn with_specifier_replacing(
&mut self,
specifier: impl Into<LinkageSpecifier>,
) -> &mut Self
pub fn with_specifier_replacing( &mut self, specifier: impl Into<LinkageSpecifier>, ) -> &mut Self
Add a specifier to the linkage. If a matching specifier already exists, it will replace it.
Thin wrapper around Self::replace_specifier, which discards the old specifier.
Sourcepub fn with_thread(&mut self) -> &mut Self
pub fn with_thread(&mut self) -> &mut Self
Marks the linkage as thread if not already marked as such.
Does nothing if that linkage has already been specified.
Sourcepub fn with_export(&mut self) -> &mut Self
pub fn with_export(&mut self) -> &mut Self
Marks the linkage as export if not already marked as such.
Does nothing if that linkage has already been specified.
Sourcepub fn with_simple_section(&mut self, name: impl Into<AstString>) -> &mut Self
pub fn with_simple_section(&mut self, name: impl Into<AstString>) -> &mut Self
Add a LinkageSection with just a name (no flags).
§Panics
Will panic if a section has already been specified.
Sourcepub fn with_section_and_flags(
&mut self,
name: impl Into<AstString>,
flags: impl Into<AstString>,
) -> &mut Self
pub fn with_section_and_flags( &mut self, name: impl Into<AstString>, flags: impl Into<AstString>, ) -> &mut Self
Add a LinkageSection with both a name and flags.
§Panics
If a section has already been specified, this will panic
Sourcepub fn try_with_specifier(
&mut self,
specifier: impl Into<LinkageSpecifier>,
) -> Result<&mut Self, DuplicateSpecifierError>
pub fn try_with_specifier( &mut self, specifier: impl Into<LinkageSpecifier>, ) -> Result<&mut Self, DuplicateSpecifierError>
Try to add a specifier to the linkage, returning an error if it conflicts with an existing specifier.
Sourcepub fn replace_specifier(
&mut self,
specifier: impl Into<LinkageSpecifier>,
) -> Option<LinkageSpecifier>
pub fn replace_specifier( &mut self, specifier: impl Into<LinkageSpecifier>, ) -> Option<LinkageSpecifier>
Add a specifier to the linkage, overriding any conflicting specifier.
Returns the old specifier if present