Skip to content

Commit 6793884

Browse files
committed
Make Error and OpaqueError cloneable
1 parent 324f57e commit 6793884

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/error.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl Ruby {
9494
pub type Result<T> = std::result::Result<T, Error>;
9595

9696
/// The possible types of [`Error`].
97-
#[derive(Debug)]
97+
#[derive(Debug, Clone)]
9898
pub enum ErrorType {
9999
/// An interrupt, such as `break` or `throw`.
100100
Jump(Tag),
@@ -106,7 +106,7 @@ pub enum ErrorType {
106106
}
107107

108108
/// Wrapper type for Ruby `Exception`s or other interrupts.
109-
#[derive(Debug)]
109+
#[derive(Debug, Clone)]
110110
pub struct Error(ErrorType);
111111

112112
impl Error {
@@ -350,6 +350,7 @@ impl IntoError for Error {
350350
/// Note that `OpaqueError` contains a Ruby value, so must be kept on the stack
351351
/// of a Ruby thread to prevent it from being Garbage Collected (or otherwise
352352
/// protected from premature GC).
353+
#[derive(Clone)]
353354
pub struct OpaqueError(ErrorType);
354355

355356
unsafe impl Send for OpaqueError {}
@@ -394,7 +395,7 @@ impl IntoError for OpaqueError {
394395

395396
/// The state of a call to Ruby exiting early, interrupting the normal flow
396397
/// of code.
397-
#[derive(Debug)]
398+
#[derive(Debug, Clone, Copy)]
398399
#[repr(i32)]
399400
pub enum Tag {
400401
// None = 0,

0 commit comments

Comments
 (0)