pub struct WitPrinter<O: Output = OutputToString> {
pub output: O,
/* private fields */
}
Expand description
A utility for printing WebAssembly interface definitions to a string.
Fields§
§output: O
Visitor that holds the WIT document being printed.
Implementations§
Source§impl<O: Output> WitPrinter<O>
impl<O: Output> WitPrinter<O>
Sourcepub fn print(
&mut self,
resolve: &Resolve,
pkg: PackageId,
nested: &[PackageId],
) -> Result<()>
pub fn print( &mut self, resolve: &Resolve, pkg: PackageId, nested: &[PackageId], ) -> Result<()>
Prints the specified pkg
which is located in resolve
to O
.
The nested
list of packages are other packages to include at the end
of the output in package ... { ... }
syntax.
Sourcepub fn emit_docs(&mut self, enabled: bool) -> &mut Self
pub fn emit_docs(&mut self, enabled: bool) -> &mut Self
Configure whether doc comments will be printed.
Defaults to true.
Sourcepub fn print_package(
&mut self,
resolve: &Resolve,
pkg: PackageId,
is_main: bool,
) -> Result<()>
pub fn print_package( &mut self, resolve: &Resolve, pkg: PackageId, is_main: bool, ) -> Result<()>
Prints the specified pkg
.
If is_main
is not set, nested package notation is used.
Sourcepub fn print_package_outer(&mut self, pkg: &Package) -> Result<()>
pub fn print_package_outer(&mut self, pkg: &Package) -> Result<()>
Print the specified package without its content. Does not print the semicolon nor starts the indentation.
Sourcepub fn print_interface_outer(
&mut self,
resolve: &Resolve,
id: InterfaceId,
name: &str,
) -> Result<()>
pub fn print_interface_outer( &mut self, resolve: &Resolve, id: InterfaceId, name: &str, ) -> Result<()>
Print the given WebAssembly interface without its content. Does not print the semicolon nor starts the indentation.
Sourcepub fn print_interface(
&mut self,
resolve: &Resolve,
id: InterfaceId,
) -> Result<()>
pub fn print_interface( &mut self, resolve: &Resolve, id: InterfaceId, ) -> Result<()>
Print the inner content of a given WebAssembly interface.
Trait Implementations§
Auto Trait Implementations§
impl<O> Freeze for WitPrinter<O>where
O: Freeze,
impl<O> RefUnwindSafe for WitPrinter<O>where
O: RefUnwindSafe,
impl<O> Send for WitPrinter<O>where
O: Send,
impl<O> Sync for WitPrinter<O>where
O: Sync,
impl<O> Unpin for WitPrinter<O>where
O: Unpin,
impl<O> UnwindSafe for WitPrinter<O>where
O: UnwindSafe,
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