Skip to content

Commit fb1ed4c

Browse files
committed
add as_local and as_remote
1 parent eae87b0 commit fb1ed4c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/mdbx-remote/src/any.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,20 @@ impl EnvironmentAny {
185185
Self::open_with_defaults(url, defaults).await
186186
}
187187

188+
pub fn as_local(&self) -> Option<&Environment> {
189+
match self {
190+
Self::Local(env) => Some(env),
191+
Self::Remote(_) => None,
192+
}
193+
}
194+
195+
pub fn as_remote(&self) -> Option<&RemoteEnvironment> {
196+
match self {
197+
Self::Remote(env) => Some(env),
198+
Self::Local(_) => None,
199+
}
200+
}
201+
188202
pub async fn begin_ro_txn(&self) -> Result<TransactionAny<RO>> {
189203
match self {
190204
Self::Local(env) => {

0 commit comments

Comments
 (0)