-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pmrmodel_base: a bounded version of exposure types
- The bounded version will own an inner copy and a reference to the origin backend, this will allow additional querying of data. - However, there were some lifetime difficulties with traits and impls when trying to convert the existing impls fns from returning the current unbound version to return the bounded ref version. - Reference: rust-lang/rust#105572
- Loading branch information
1 parent
400bfa8
commit bc68507
Showing
6 changed files
with
308 additions
and
16 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
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
use crate::exposure::{ | ||
Exposure, | ||
ExposureFile, | ||
ExposureFileView, | ||
traits, | ||
}; | ||
|
||
pub struct ExposureRef<'a> { | ||
pub(super) inner: Exposure, | ||
// pub(super) inner_files: ExposureFileRefs<'a>, | ||
pub(super) backend: &'a dyn traits::Backend, | ||
} | ||
|
||
pub struct ExposureRefs<'a>(Vec<ExposureRef<'a>>); | ||
|
||
pub struct ExposureFileRef<'a> { | ||
pub(super) inner: ExposureFile, | ||
// pub(super) inner_views: ExposureFileViewRefs<'a>, | ||
pub(super) backend: &'a dyn traits::Backend, | ||
} | ||
|
||
pub struct ExposureFileRefs<'a>(pub(super) Vec<ExposureFileRef<'a>>); | ||
|
||
pub struct ExposureFileViewRef<'a> { | ||
pub(super) inner: ExposureFileView, | ||
pub(super) backend: &'a dyn traits::Backend, | ||
} | ||
|
||
pub struct ExposureFileViewRefs<'a>(pub(super) Vec<ExposureFileViewRef<'a>>); | ||
|
||
impl Exposure { | ||
pub(super) fn bind<'a>( | ||
self, | ||
backend: &'a dyn traits::Backend, | ||
) -> ExposureRef<'a> { | ||
ExposureRef { | ||
inner: self, | ||
backend: backend, | ||
} | ||
} | ||
} | ||
|
||
impl ExposureRef<'_> { | ||
pub fn into_inner(self) -> Exposure { | ||
self.inner | ||
} | ||
} | ||
|
||
impl ExposureFile { | ||
pub(super) fn bind<'a>( | ||
self, | ||
backend: &'a dyn traits::Backend, | ||
) -> ExposureFileRef<'a> { | ||
ExposureFileRef { | ||
inner: self, | ||
backend: backend, | ||
} | ||
} | ||
} | ||
|
||
impl ExposureFileRef<'_> { | ||
pub fn into_inner(self) -> ExposureFile { | ||
self.inner | ||
} | ||
} | ||
|
||
impl ExposureFileView { | ||
pub(super) fn bind<'a>( | ||
self, | ||
backend: &'a dyn traits::Backend, | ||
) -> ExposureFileViewRef<'a> { | ||
ExposureFileViewRef { | ||
inner: self, | ||
backend: backend, | ||
} | ||
} | ||
} | ||
|
||
impl ExposureFileViewRef<'_> { | ||
pub fn into_inner(self) -> ExposureFileView { | ||
self.inner | ||
} | ||
} |
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