pub struct Component {
pub exports: Vec<String>,
pub imports: Vec<String>,
pub target: Option<String>,
}
Expand description
Information about the component in the manifest. This is generally synthesized from a component’s world
Fields§
§exports: Vec<String>
A list of all exports from the component
imports: Vec<String>
A list of all imports from the component
target: Option<String>
Implementations§
source§impl Component
impl Component
sourcepub fn from_world(resolve: &Resolve, world_id: WorldId) -> Result<Self>
pub fn from_world(resolve: &Resolve, world_id: WorldId) -> Result<Self>
sourcepub fn from_package(resolve: &Resolve, pkg_id: PackageId) -> Result<Self>
pub fn from_package(resolve: &Resolve, pkg_id: PackageId) -> Result<Self>
Create a component from a parsed Resolve
and PackageId
. This is a lower level
function for when you have already parsed a binary wit package and have the package ID and
resolve available. This outputs a component with all exports and an empty imports list.
Returns an error only if the package doesn’t exist in the resolve.
sourcepub async fn from_component(path: impl AsRef<Path>) -> Result<Self>
pub async fn from_component(path: impl AsRef<Path>) -> Result<Self>
Create a component by loading the given component from the filesystem
sourcepub fn from_raw_component(raw: impl AsRef<[u8]>) -> Result<Self>
pub fn from_raw_component(raw: impl AsRef<[u8]>) -> Result<Self>
Create a component from the raw bytes of the component
Trait Implementations§
source§impl<'de> Deserialize<'de> for Component
impl<'de> Deserialize<'de> for Component
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin for Component
impl UnwindSafe for Component
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