Missed a generic-array type

This commit is contained in:
Nicolas Stalder
2021-06-10 16:21:02 -04:00
committed by Nicolas Stalder
parent cdcb99fea7
commit 3fda2fb7e8
4 changed files with 7 additions and 11 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "littlefs2"
description = "Idiomatic Rust API for littlefs"
version = "0.3.0"
version = "0.3.1"
authors = ["Nicolas Stalder <n@stalder.io>", "Brandon Edens <brandonedens@gmail.com>"]
edition = "2018"
license = "Apache-2.0 OR MIT"
+5 -7
View File
@@ -67,11 +67,11 @@ pub trait Storage {
///// to the C backend.
//type FILENAME_MAX_PLUS_ONE: ArrayLength<u8>;
/// Maximum length of a path plus one. Necessary to convert Rust string slices
/// to C strings, which requires an allocation for the terminating
/// zero-byte. If in doubt, set to `FILENAME_MAX_PLUS_ONE`.
/// Must be larger than `FILENAME_MAX_PLUS_ONE`.
type PATH_MAX_PLUS_ONE: ArrayLength<u8>;
// /// Maximum length of a path plus one. Necessary to convert Rust string slices
// /// to C strings, which requires an allocation for the terminating
// /// zero-byte. If in doubt, set to `FILENAME_MAX_PLUS_ONE`.
// /// Must be larger than `FILENAME_MAX_PLUS_ONE`.
// type PATH_MAX_PLUS_ONE: ArrayLength<u8>;
///// Maximum size of file. Stored in superblock.
///// Defaults to 2_147_483_647 (or u31, to avoid sign issues in the C code).
@@ -136,8 +136,6 @@ mod future {
// TODO: this supposedly influences whether files are inlined or not. Clarify
type CACHE_SIZE;
type LOOKAHEADWORDS_SIZE;
// not part of littlefs
type PATH_MAX_PLUS_ONE;
}
pub trait RuntimeParameters {
+1 -1
View File
@@ -96,7 +96,7 @@ impl<Storage: driver::Storage> Allocation<Storage> {
debug_assert!(filename_max_plus_one <= 1_022+1);
// limitation of ll-bindings
debug_assert!(filename_max_plus_one == 255+1);
let path_max_plus_one: u32 = <Storage as driver::Storage>::PATH_MAX_PLUS_ONE::to_u32();
let path_max_plus_one: u32 = crate::consts::PATH_MAX_PLUS_ONE as _;
// TODO: any upper limit?
debug_assert!(path_max_plus_one >= filename_max_plus_one);
let file_max = crate::consts::FILEBYTES_MAX;
-2
View File
@@ -50,7 +50,6 @@ macro_rules! ram_storage { (
const BLOCK_SIZE: usize = $block_size;
const BLOCK_COUNT: usize = $block_count;
type LOOKAHEADWORDS_SIZE = $lookaheadwords_size;
type PATH_MAX_PLUS_ONE = $path_max_plus_one;
fn read(&self, offset: usize, buf: &mut [u8]) -> $Result<usize> {
let read_size: usize = Self::READ_SIZE;
@@ -180,7 +179,6 @@ macro_rules! const_ram_storage { (
const BLOCK_SIZE: usize = $block_size;
const BLOCK_COUNT: usize = $block_count;
type LOOKAHEADWORDS_SIZE = $lookaheadwords_size;
type PATH_MAX_PLUS_ONE = $path_max_plus_one;
fn read(&self, offset: usize, buf: &mut [u8]) -> $Result<usize> {
let read_size: usize = Self::READ_SIZE;