pub struct Remap { /* private fields */ }Expand description
Describes where a requested interface is found in a plugin’s exports.
Plugin::remap_interfaces stores these values in a map whose key is the
requested interface name from the Binding. The Remap
value then describes the interface name and item names actually exported by
that plugin.
§Examples
use std::collections::HashMap;
use wasm_link::Remap;
let interface_only = Remap::found_as( "legacy-root" );
let one_item = Remap::resolves_item( "get-value", "legacy-get-value" );
let many_items = Remap::item_resolution_table( HashMap::from([
( "get-value".to_string(), "legacy-get-value".to_string() ),
]));
let interface_and_items = Remap::found_as_with_item_resolution_table(
"legacy-root",
HashMap::from([( "get-value".to_string(), "legacy-get-value".to_string() )]),
);Implementations§
Source§impl Remap
impl Remap
Sourcepub fn found_as(interface: impl Into<String>) -> Self
pub fn found_as(interface: impl Into<String>) -> Self
Creates a remap where the requested interface is found under another exported name.
Sourcepub fn resolves_item(
requested_item: impl Into<String>,
exported_item: impl Into<String>,
) -> Self
pub fn resolves_item( requested_item: impl Into<String>, exported_item: impl Into<String>, ) -> Self
Creates a remap where one requested item resolves to another exported item name.
The first argument is the requested item name. The second argument is the item name exported by the plugin.
Sourcepub fn item_resolution_table(item_resolution_table: ItemResolutionTable) -> Self
pub fn item_resolution_table(item_resolution_table: ItemResolutionTable) -> Self
Creates a remap from an item resolution table.
The table direction is requested item name -> exported item name.
Sourcepub fn found_as_with_item_resolution_table(
interface: impl Into<String>,
item_resolution_table: ItemResolutionTable,
) -> Self
pub fn found_as_with_item_resolution_table( interface: impl Into<String>, item_resolution_table: ItemResolutionTable, ) -> Self
Creates a remap for both the interface name and its item names.
The item table direction is requested item name -> exported item name.
Trait Implementations§
impl Eq for Remap
impl StructuralPartialEq for Remap
Auto Trait Implementations§
impl Freeze for Remap
impl RefUnwindSafe for Remap
impl Send for Remap
impl Sync for Remap
impl Unpin for Remap
impl UnsafeUnpin for Remap
impl UnwindSafe for Remap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more