Skip to content

Commit 328abd3

Browse files
committed
Add as_ptr for primitive enums
1 parent ce962f1 commit 328abd3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lax/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ impl UPLO {
141141
UPLO::Lower => UPLO::Upper,
142142
}
143143
}
144+
145+
/// To use Fortran LAPACK API in lapack-sys crate
146+
pub fn as_ptr(&self) -> *const i8 {
147+
self as *const UPLO as *const i8
148+
}
144149
}
145150

146151
#[derive(Debug, Clone, Copy)]
@@ -151,6 +156,13 @@ pub enum Transpose {
151156
Hermite = b'C',
152157
}
153158

159+
impl Transpose {
160+
/// To use Fortran LAPACK API in lapack-sys crate
161+
pub fn as_ptr(&self) -> *const i8 {
162+
self as *const Transpose as *const i8
163+
}
164+
}
165+
154166
#[derive(Debug, Clone, Copy)]
155167
#[repr(u8)]
156168
pub enum NormType {
@@ -167,6 +179,11 @@ impl NormType {
167179
NormType::Frobenius => NormType::Frobenius,
168180
}
169181
}
182+
183+
/// To use Fortran LAPACK API in lapack-sys crate
184+
pub fn as_ptr(&self) -> *const i8 {
185+
self as *const NormType as *const i8
186+
}
170187
}
171188

172189
/// Create a vector without initialization

0 commit comments

Comments
 (0)