Skip to content

Commit 184d615

Browse files
committed
Add derive-new
1 parent 11cfab5 commit 184d615

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ openblas = ["blas/openblas", "lapack/openblas"]
1515
netlib = ["blas/netlib", "lapack/netlib"]
1616

1717
[dependencies]
18+
derive-new = "0.4"
1819
enum-error-derive = "0.1"
1920
num-traits = "0.1"
2021
num-complex = "0.1"

src/error.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use std::error;
44
use std::fmt;
55
use ndarray::{Ixs, ShapeError};
66

7+
pub type LResult<T> = Result<T, LinalgError>;
8+
79
#[derive(Debug, EnumError)]
810
pub enum LinalgError {
911
NotSquare(NotSquareError),
@@ -13,7 +15,7 @@ pub enum LinalgError {
1315
Shape(ShapeError),
1416
}
1517

16-
#[derive(Debug)]
18+
#[derive(Debug, new)]
1719
pub struct LapackError {
1820
pub return_code: i32,
1921
}
@@ -36,7 +38,7 @@ impl From<i32> for LapackError {
3638
}
3739
}
3840

39-
#[derive(Debug)]
41+
#[derive(Debug, new)]
4042
pub struct NotSquareError {
4143
pub rows: usize,
4244
pub cols: usize,
@@ -54,7 +56,7 @@ impl error::Error for NotSquareError {
5456
}
5557
}
5658

57-
#[derive(Debug)]
59+
#[derive(Debug, new)]
5860
pub struct StrideError {
5961
pub s0: Ixs,
6062
pub s1: Ixs,
@@ -72,7 +74,7 @@ impl error::Error for StrideError {
7274
}
7375
}
7476

75-
#[derive(Debug)]
77+
#[derive(Debug, new)]
7678
pub struct MemoryContError {}
7779

7880
impl fmt::Display for MemoryContError {

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ extern crate num_complex;
3939
extern crate ndarray;
4040
#[macro_use]
4141
extern crate enum_error_derive;
42+
#[macro_use]
43+
extern crate derive_new;
4244

4345
pub mod impls;
4446
pub mod error;

0 commit comments

Comments
 (0)