give SectorSize the 'static lifetime

This commit is contained in:
Szymon Walter 2018-03-22 09:57:32 +01:00
parent 36f13bea2a
commit 7e2b3bc2f1
2 changed files with 6 additions and 6 deletions

View file

@ -220,7 +220,7 @@ impl<S: SectorSize, V: Volume<u8, S>> Debug for Ext2<S, V> {
} }
} }
pub struct Inodes<'vol, S: 'vol + SectorSize, V: 'vol + Volume<u8, S>> { pub struct Inodes<'vol, S: SectorSize, V: 'vol + Volume<u8, S>> {
fs: &'vol Ext2<S, V>, fs: &'vol Ext2<S, V>,
block_groups: &'vol [BlockGroupDescriptor], block_groups: &'vol [BlockGroupDescriptor],
log_block_size: u32, log_block_size: u32,
@ -260,12 +260,12 @@ impl<'vol, S: SectorSize, V: 'vol + Volume<u8, S>> Iterator
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Inode<'vol, S: 'vol + SectorSize, V: 'vol + Volume<u8, S>> { pub struct Inode<'vol, S: SectorSize, V: 'vol + Volume<u8, S>> {
fs: &'vol Ext2<S, V>, fs: &'vol Ext2<S, V>,
inner: RawInode, inner: RawInode,
} }
impl<'vol, S: 'vol + SectorSize, V: 'vol + Volume<u8, S>> Inode<'vol, S, V> { impl<'vol, S: SectorSize, V: 'vol + Volume<u8, S>> Inode<'vol, S, V> {
pub fn new(fs: &'vol Ext2<S, V>, inner: RawInode) -> Inode<'vol, S, V> { pub fn new(fs: &'vol Ext2<S, V>, inner: RawInode) -> Inode<'vol, S, V> {
Inode { fs, inner } Inode { fs, inner }
} }
@ -442,7 +442,7 @@ impl<'vol, S: 'vol + SectorSize, V: 'vol + Volume<u8, S>> Inode<'vol, S, V> {
pub struct InodeBlocks< pub struct InodeBlocks<
'vol: 'inode, 'vol: 'inode,
'inode, 'inode,
S: 'vol + SectorSize, S: SectorSize,
V: 'vol + Volume<u8, S>, V: 'vol + Volume<u8, S>,
> { > {
inode: &'inode Inode<'vol, S, V>, inode: &'inode Inode<'vol, S, V>,
@ -482,7 +482,7 @@ impl<'vol, 'inode, S: SectorSize, V: 'vol + Volume<u8, S>> Iterator
pub struct Directory< pub struct Directory<
'vol: 'inode, 'vol: 'inode,
'inode, 'inode,
S: 'vol + SectorSize, S: SectorSize,
V: 'vol + Volume<u8, S>, V: 'vol + Volume<u8, S>,
> { > {
blocks: InodeBlocks<'vol, 'inode, S, V>, blocks: InodeBlocks<'vol, 'inode, S, V>,

View file

@ -4,7 +4,7 @@ use core::ops::{Add, Sub};
use core::fmt::{self, Debug, Display, LowerHex}; use core::fmt::{self, Debug, Display, LowerHex};
use core::iter::Step; use core::iter::Step;
pub trait SectorSize: Clone + Copy + PartialEq + PartialOrd { pub trait SectorSize: Clone + Copy + PartialEq + PartialOrd + 'static {
// log_sector_size = log_2(sector_size) // log_sector_size = log_2(sector_size)
const LOG_SIZE: u32; const LOG_SIZE: u32;
const SIZE: usize = 1 << Self::LOG_SIZE; const SIZE: usize = 1 << Self::LOG_SIZE;