-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add identity projection to the file reader (#532)
- Loading branch information
Showing
4 changed files
with
35 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
#[derive(Clone)] | ||
pub struct Projection { | ||
indices: Vec<usize>, | ||
#[derive(Clone, Default)] | ||
pub enum Projection { | ||
#[default] | ||
All, | ||
Partial(Vec<usize>), | ||
} | ||
|
||
impl Projection { | ||
pub fn new(indices: impl AsRef<[usize]>) -> Self { | ||
Projection { | ||
indices: Vec::from(indices.as_ref()), | ||
} | ||
} | ||
|
||
pub fn indices(&self) -> &[usize] { | ||
self.indices.as_ref() | ||
Self::Partial(Vec::from(indices.as_ref())) | ||
} | ||
} | ||
|
||
impl From<Vec<usize>> for Projection { | ||
fn from(indices: Vec<usize>) -> Self { | ||
Self { indices } | ||
Self::Partial(indices) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters