Skip to content

Commit aa67630

Browse files
mangelatsLuthaf
authored andcommitted
Fix and improve documentation
1 parent db74493 commit aa67630

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

soa-derive-internal/src/slice.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ pub fn derive(input: &Input) -> TokenStream {
177177
/// Similar to [`std::ops::Index` trait](https://doc.rust-lang.org/std/ops/trait.Index.html) on
178178
#[doc = #slice_name_str]
179179
/// .
180-
/// This is required because we cannot implement that trait.
180+
/// This is required because we cannot implement `std::ops::Index` directly since it requires returning a reference.
181181
pub fn index<'b, I>(&'b self, index: I) -> I::RefOutput
182182
where
183183
I: ::soa_derive::SoAIndex<#slice_name<'b>>,
@@ -187,7 +187,7 @@ pub fn derive(input: &Input) -> TokenStream {
187187
index.index(slice)
188188
}
189189

190-
/// Reborrows the slices in a more narrower lifetime
190+
/// Reborrows the slices in a narrower lifetime
191191
pub fn reborrow<'b>(&'b self) -> #slice_name<'b>
192192
where
193193
'a: 'b
@@ -468,7 +468,7 @@ pub fn derive_mut(input: &Input) -> TokenStream {
468468
/// Similar to [`std::ops::IndexMut` trait](https://doc.rust-lang.org/std/ops/trait.IndexMut.html) on
469469
#[doc = #slice_name_str]
470470
/// .
471-
/// This is required because we cannot implement that trait.
471+
/// This is required because we cannot implement `std::ops::IndexMut` directly since it requires returning a mutable reference.
472472
pub fn index_mut<'b, I>(&'b mut self, index: I) -> I::MutOutput
473473
where
474474
I: ::soa_derive::SoAIndexMut<#slice_mut_name<'b>>,
@@ -488,7 +488,7 @@ pub fn derive_mut(input: &Input) -> TokenStream {
488488
}
489489
}
490490

491-
/// Reborrows the slices in a more narrower lifetime
491+
/// Reborrows the slices in a narrower lifetime
492492
pub fn reborrow<'b>(&'b mut self) -> #slice_mut_name<'b>
493493
where
494494
'a: 'b

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,23 +193,23 @@ pub trait SoAIndex<T>: private_soa_indexs::Sealed {
193193
/// The output for the non-mutable functions
194194
type RefOutput;
195195

196-
/// Returns the reference output in this location if in bounds. None otherwise.
196+
/// Returns the reference output in this location if in bounds, `None` otherwise.
197197
fn get(self, soa: T) -> Option<Self::RefOutput>;
198-
/// Returns the reference output in this location withotu performing any bounds check.
198+
/// Returns the reference output in this location without performing any bounds check.
199199
unsafe fn get_unchecked(self, soa: T) -> Self::RefOutput;
200200
/// Returns the reference output in this location. Panics if it is not in bounds.
201201
fn index(self, soa: T) -> Self::RefOutput;
202202
}
203203

204-
/// Helper trait used for indexing operations returning mutable.
204+
/// Helper trait used for indexing operations returning mutable references.
205205
/// Inspired by [`std::slice::SliceIndex`](https://doc.rust-lang.org/std/slice/trait.SliceIndex.html).
206206
pub trait SoAIndexMut<T>: private_soa_indexs::Sealed {
207207
/// The output for the mutable functions
208208
type MutOutput;
209209

210-
/// Returns the mutable reference output in this location if in bounds. None otherwise.
210+
/// Returns the mutable reference output in this location if in bounds, `None` otherwise.
211211
fn get_mut(self, soa: T) -> Option<Self::MutOutput>;
212-
/// Returns the mutable reference output in this location withotu performing any bounds check.
212+
/// Returns the mutable reference output in this location without performing any bounds check.
213213
unsafe fn get_unchecked_mut(self, soa: T) -> Self::MutOutput;
214214
/// Returns the mutable reference output in this location. Panics if it is not in bounds.
215215
fn index_mut(self, soa: T) -> Self::MutOutput;

0 commit comments

Comments
 (0)