pub struct RenameAttr {
pattern: Option<RenamePattern>,
}
Expand description
A pattern for use in rename attributes, like #[diplomat::abi_rename]
This can be parsed from a string, typically something like icu4x_{0}
.
It can have up to one {0} for replacement.
In the future this may support transformations like to_camel_case, etc,
probably specified as a list like #[diplomat::abi_rename("foo{0}", to_camel_case)]
Fields§
§pattern: Option<RenamePattern>
Implementations§
source§impl RenameAttr
impl RenameAttr
sourcepub fn apply<'a>(&'a self, name: Cow<'a, str>) -> Cow<'a, str>
pub fn apply<'a>(&'a self, name: Cow<'a, str>) -> Cow<'a, str>
Apply all renames to a given string
pub(crate) fn extend(&mut self, other: &Self)
sourcepub(crate) fn attrs_for_inheritance(
&self,
context: AttrInheritContext,
is_abi_rename: bool,
) -> Self
pub(crate) fn attrs_for_inheritance( &self, context: AttrInheritContext, is_abi_rename: bool, ) -> Self
Get a copy of these attributes for use in inheritance, masking out things that should not be inherited
sourcefn from_pattern(s: &str) -> Self
fn from_pattern(s: &str) -> Self
From a replacement pattern, like “icu4x_{0}”. Can have up to one {0} in it for substitution.
pub(crate) fn from_meta(meta: &Meta) -> Result<Self, &'static str>
Trait Implementations§
source§impl Clone for RenameAttr
impl Clone for RenameAttr
source§fn clone(&self) -> RenameAttr
fn clone(&self) -> RenameAttr
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RenameAttr
impl Debug for RenameAttr
source§impl Default for RenameAttr
impl Default for RenameAttr
source§fn default() -> RenameAttr
fn default() -> RenameAttr
Returns the “default value” for a type. Read more
source§impl Hash for RenameAttr
impl Hash for RenameAttr
source§impl Ord for RenameAttr
impl Ord for RenameAttr
source§fn cmp(&self, other: &RenameAttr) -> Ordering
fn cmp(&self, other: &RenameAttr) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for RenameAttr
impl PartialEq for RenameAttr
source§impl PartialOrd for RenameAttr
impl PartialOrd for RenameAttr
source§impl Serialize for RenameAttr
impl Serialize for RenameAttr
impl Eq for RenameAttr
impl StructuralPartialEq for RenameAttr
Auto Trait Implementations§
impl Freeze for RenameAttr
impl RefUnwindSafe for RenameAttr
impl Send for RenameAttr
impl Sync for RenameAttr
impl Unpin for RenameAttr
impl UnwindSafe for RenameAttr
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)