Skip to content

Commit b2fbe16

Browse files
authored
feat: re-export cxx::Exception (#41)
1 parent a229b37 commit b2fbe16

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/cpp/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Re-export CXX Exception type to simplify usage
2+
pub use cxx::Exception;
13
use cxx::UniquePtr;
24

35
#[cxx::bridge(namespace = "FastPForLib")]
@@ -84,7 +86,7 @@ pub trait Codec32: CodecWrapper {
8486
&self,
8587
input: &[u32],
8688
output: &'out mut [u32],
87-
) -> Result<&'out mut [u32], cxx::Exception> {
89+
) -> Result<&'out mut [u32], Exception> {
8890
let n = ffi::codec_encode32(self.codec(), input, output)?;
8991
Ok(&mut output[..n])
9092
}
@@ -94,7 +96,7 @@ pub trait Codec32: CodecWrapper {
9496
&self,
9597
input: &[u32],
9698
output: &'out mut [u32],
97-
) -> Result<&'out mut [u32], cxx::Exception> {
99+
) -> Result<&'out mut [u32], Exception> {
98100
let n = ffi::codec_decode32(self.codec(), input, output)?;
99101
Ok(&mut output[..n])
100102
}
@@ -107,7 +109,7 @@ pub trait Codec64: CodecWrapper {
107109
&self,
108110
input: &[u64],
109111
output: &'out mut [u32],
110-
) -> Result<&'out mut [u32], cxx::Exception> {
112+
) -> Result<&'out mut [u32], Exception> {
111113
let n = ffi::codec_encode64(self.codec(), input, output)?;
112114
Ok(&mut output[..n])
113115
}
@@ -117,7 +119,7 @@ pub trait Codec64: CodecWrapper {
117119
&self,
118120
input: &[u32],
119121
output: &'out mut [u64],
120-
) -> Result<&'out mut [u64], cxx::Exception> {
122+
) -> Result<&'out mut [u64], Exception> {
121123
let n = ffi::codec_decode64(self.codec(), input, output)?;
122124
Ok(&mut output[..n])
123125
}

0 commit comments

Comments
 (0)