Skip to content

Commit 596e756

Browse files
committed
Make buf::inner public
Needed to make the Inner interface visible in docs.
1 parent 281d7b9 commit 596e756

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ resolver = "2"
2020

2121
[workspace.package]
2222
edition = "2021"
23-
version = "0.3.0"
23+
version = "0.3.2"
2424
authors = ["Johannes 'Sharlin' Dahlström <johannes.dahlstrom@gmail.com>"]
2525
license = "MIT OR Apache-2.0"
2626
repository = "https://github.com/jdahlstrom/retrofire"

core/src/util/buf.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<'a, T> DerefMut for MutSlice2<'a, T> {
278278
}
279279
}
280280

281-
mod inner {
281+
pub mod inner {
282282
use core::fmt::Formatter;
283283
use core::marker::PhantomData;
284284
use core::ops::{Deref, DerefMut, Index, IndexMut, Range};
@@ -290,6 +290,7 @@ mod inner {
290290
use super::{AsSlice2, MutSlice2, Slice2};
291291

292292
/// A helper type that abstracts over owned and borrowed buffers.
293+
///
293294
/// The types `Buf2`, `Slice2`, and `MutSlice2` deref to `Inner`.
294295
#[derive(Copy, Clone)]
295296
pub struct Inner<T, D> {
@@ -435,16 +436,18 @@ mod inner {
435436
}
436437

437438
/// Returns an iterator over the rows of `self` as `&[T]` slices.
439+
///
438440
/// The length of each slice equals [`self.width()`](Self::width).
439441
pub fn rows(&self) -> impl Iterator<Item = &[T]> {
440442
self.data
441443
.chunks(self.stride as usize)
442444
.map(|row| &row[..self.dims.0 as usize])
443445
}
444446

445-
/// Returns an iterator over all the elements of `self` in row-major
446-
/// order: first the elements on row 0 from left to right, followed
447-
/// by the elements on row 1, and so on.
447+
/// Returns an iterator over all the elements of `self` in row-major order.
448+
///
449+
/// First returns the elements on row 0 from left to right, followed by the elements
450+
/// on row 1, and so on.
448451
pub fn iter(&self) -> impl Iterator<Item = &'_ T> {
449452
self.rows().flatten()
450453
}
@@ -455,11 +458,14 @@ mod inner {
455458
pub fn as_mut_slice2(&mut self) -> MutSlice2<T> {
456459
MutSlice2::new(self.dims, self.stride, &mut self.data)
457460
}
461+
458462
/// Returns the data of `self` as a single mutable slice.
459463
pub(super) fn data_mut(&mut self) -> &mut [T] {
460464
&mut self.data
461465
}
462-
/// Returns an iterator over the rows of this buffer as &mut [T].
466+
467+
/// Returns an iterator over the rows of this buffer as `&mut [T]`.
468+
///
463469
/// The length of each slice equals [`self.width()`](Self::width).
464470
pub fn rows_mut(&mut self) -> impl Iterator<Item = &mut [T]> {
465471
self.data

0 commit comments

Comments
 (0)