Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix typos #761

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/bytecode/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl From<i32> for BranchOffset {
}

impl BranchOffset {
/// Creates an uninitalized [`BranchOffset`].
/// Creates an uninitialized [`BranchOffset`].
pub fn uninit() -> Self {
Self(0)
}
Expand Down
8 changes: 4 additions & 4 deletions crates/wasmi/src/engine/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum FuelConsumptionMode {
///
/// Lazy fuel consumption means that fuel for bulk-operations
/// is checked before executing the instruction but only consumed
/// if the executed instruction suceeded. The reason for this is
/// if the executed instruction succeeded. The reason for this is
/// that bulk-operations fail fast and therefore do not cost
/// a lot of compute power in case of failure.
///
Expand All @@ -77,7 +77,7 @@ pub enum FuelConsumptionMode {
///
/// Eager fuel consumption means that fuel for bulk-operations
/// is always consumed before executing the instruction independent
/// of it suceeding or failing.
/// of it succeeding or failing.
///
/// # Note
///
Expand All @@ -98,9 +98,9 @@ pub struct FuelCosts {
///
/// # Note
///
/// A Wasm entitiy is one of `func`, `global`, `memory` or `table`.
/// A Wasm entity is one of `func`, `global`, `memory` or `table`.
/// Those instructions are usually a bit more costly since they need
/// multiplie indirect accesses through the Wasm instance and store.
/// multiple indirect accesses through the Wasm instance and store.
pub entity: u64,
/// The fuel cost offset for `memory.load` instructions.
pub load: u64,
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/func_builder/translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ impl<'parser> FuncTranslator<'parser> {
self.stack_height.push_n(results.len() as u32);
}

/// Returns `Some` equivalent instruction if the `global.get` can be optimzied.
/// Returns `Some` equivalent instruction if the `global.get` can be optimized.
///
/// # Note
///
Expand Down
14 changes: 7 additions & 7 deletions crates/wasmi/src/engine/resumable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl ResumableCall {
/// State required to resume a [`Func`] invocation.
#[derive(Debug)]
pub struct ResumableInvocation {
/// The engine in use for the function invokation.
/// The engine in use for the function invocation.
///
/// # Note
///
Expand Down Expand Up @@ -160,14 +160,14 @@ impl ResumableInvocation {
/// The result is written back into the `outputs` buffer upon success.
///
/// Returns a resumable handle to the function invocation upon
/// enountering host errors with which it is possible to handle
/// the error and continue the execution as if no error occured.
/// encountering host errors with which it is possible to handle
/// the error and continue the execution as if no error occurred.
///
/// # Errors
///
/// - If the function resumption returned a Wasm [`Trap`].
/// - If the types or the number of values in `inputs` does not match
/// the types and number of result values of the errorneous host function.
/// the types and number of result values of the erroneous host function.
/// - If the number of output values does not match the expected number of
/// outputs required by the called function.
pub fn resume<T>(
Expand Down Expand Up @@ -238,14 +238,14 @@ impl<Results> TypedResumableInvocation<Results> {
/// Resumes the call to the [`TypedFunc`] with the given inputs.
///
/// Returns a resumable handle to the function invocation upon
/// enountering host errors with which it is possible to handle
/// the error and continue the execution as if no error occured.
/// encountering host errors with which it is possible to handle
/// the error and continue the execution as if no error occurred.
///
/// # Errors
///
/// - If the function resumption returned a Wasm [`Trap`].
/// - If the types or the number of values in `inputs` does not match
/// the types and number of result values of the errorneous host function.
/// the types and number of result values of the erroneous host function.
///
/// [`TypedFunc`]: [`crate::TypedFunc`]
pub fn resume<T>(
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/stack/values/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Extend<UntypedValue> for ValueStack {
}

impl ValueStack {
/// Creates an empty [`ValueStack`] that does not allocate heap memor.
/// Creates an empty [`ValueStack`] that does not allocate heap memory.
///
/// # Note
///
Expand Down
8 changes: 4 additions & 4 deletions crates/wasmi/src/engine/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ impl<'a> Iterator for CallParamsValueIter<'a> {
type Item = UntypedValue;

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(UntypedValue::from)
}

#[inline]
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(UntypedValue::from)
fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}
}

Expand Down
8 changes: 4 additions & 4 deletions crates/wasmi/src/func/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl Func {
/// - `func`: the native code invoked whenever this Func will be called.
/// The closure is provided a [`Caller`] as its first argument
/// which allows it to query information about the [`Instance`]
/// that is assocaited to the call.
/// that is associated to the call.
///
/// # Note
///
Expand All @@ -326,7 +326,7 @@ impl Func {
/// is written into the buffer then the remaining computation may fail in unexpected
/// ways. This footgun can be avoided by using the typed [`Func::wrap`] method instead.
/// - Prefer using [`Func::wrap`] over this method if possible since [`Func`] instances
/// created using this constructor have runtime overhead for every invokation that
/// created using this constructor have runtime overhead for every invocation that
/// can be avoided by using [`Func::wrap`].
pub fn new<T>(
mut ctx: impl AsContextMut<UserState = T>,
Expand Down Expand Up @@ -411,8 +411,8 @@ impl Func {
/// The result is written back into the `outputs` buffer.
///
/// Returns a resumable handle to the function invocation upon
/// enountering host errors with which it is possible to handle
/// the error and continue the execution as if no error occured.
/// encountering host errors with which it is possible to handle
/// the error and continue the execution as if no error occurred.
///
/// # Note
///
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmi/src/func/typed_func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ where
/// Calls this Wasm or host function with the specified parameters.
///
/// Returns a resumable handle to the function invocation upon
/// enountering host errors with which it is possible to handle
/// the error and continue the execution as if no error occured.
/// encountering host errors with which it is possible to handle
/// the error and continue the execution as if no error occurred.
///
/// # Note
///
Expand Down
10 changes: 5 additions & 5 deletions crates/wasmi/src/instance/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub enum Extern {
///
/// [`Cell<T>`]: https://doc.rust-lang.org/core/cell/struct.Cell.html
Global(Global),
/// A WebAssembly table which is an array of funtion references.
/// A WebAssembly table which is an array of function references.
Table(Table),
/// A WebAssembly linear memory.
Memory(Memory),
Expand Down Expand Up @@ -253,13 +253,13 @@ impl<'instance> ExportsIter<'instance> {
impl<'instance> Iterator for ExportsIter<'instance> {
type Item = Export<'instance>;

fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}

fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(Self::convert_item)
}

fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}
}

impl DoubleEndedIterator for ExportsIter<'_> {
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl<T> Linker<T> {
/// For information how to use this API see [`Func::wrap`].
///
/// This method creates a host function for this [`Linker`] under the given name.
/// It is distint in its ability to create a [`Store`] independent
/// It is distinct in its ability to create a [`Store`] independent
/// host function. Host functions defined this way can be used to instantiate
/// instances in multiple different [`Store`] entities.
///
Expand Down
12 changes: 6 additions & 6 deletions crates/wasmi/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub type Stored<Idx> = GuardedEntity<StoreIdx, Idx>;
/// both to make types a little easier to read and to provide a `Debug` impl so
/// that `#[derive(Debug)]` works on structs that contain it.
pub struct ResourceLimiterRef<'a>(Option<&'a mut (dyn ResourceLimiter)>);
impl<'a> core::fmt::Debug for ResourceLimiterRef<'a> {
impl<'a> Debug for ResourceLimiterRef<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ResourceLimiterRef(...)")
}
Expand All @@ -95,7 +95,7 @@ impl<'a> ResourceLimiterRef<'a> {
/// provide a `Debug` impl so that `#[derive(Debug)]` works on structs that
/// contain it.
struct ResourceLimiterQuery<T>(Box<dyn FnMut(&mut T) -> &mut (dyn ResourceLimiter) + Send + Sync>);
impl<T> core::fmt::Debug for ResourceLimiterQuery<T> {
impl<T> Debug for ResourceLimiterQuery<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ResourceLimiterQuery(...)")
}
Expand Down Expand Up @@ -291,7 +291,7 @@ impl StoreInner {
&mut self.fuel
}

/// Wraps an entitiy `Idx` (index type) as a [`Stored<Idx>`] type.
/// Wraps an entity `Idx` (index type) as a [`Stored<Idx>`] type.
///
/// # Note
///
Expand Down Expand Up @@ -941,7 +941,7 @@ impl<'a, T> StoreContext<'a, T> {

/// Access the underlying data owned by this store.
///
/// Same as [`Store::data`].
/// Same as [`Store::data`].
pub fn data(&self) -> &T {
self.store.data()
}
Expand Down Expand Up @@ -986,14 +986,14 @@ impl<'a, T> StoreContextMut<'a, T> {

/// Access the underlying data owned by this store.
///
/// Same as [`Store::data`].
/// Same as [`Store::data`].
pub fn data(&self) -> &T {
self.store.data()
}

/// Access the underlying data owned by this store.
///
/// Same as [`Store::data_mut`].
/// Same as [`Store::data_mut`].
pub fn data_mut(&mut self) -> &mut T {
self.store.data_mut()
}
Expand Down
Loading