Allow creating a Term from an arbitrary Read/Write pair.#93
Conversation
|
|
||
| /// Where the term is writing. | ||
| #[derive(Debug, Copy, Clone, PartialEq, Eq)] | ||
| #[derive(Debug, Clone)] |
There was a problem hiding this comment.
The derivation of Copy just isn't possible in a safe way for arbitrary Read/Write destinations. And allowing for equality checks is of questionable value, although we can add it back if need be.
There was a problem hiding this comment.
I would add it back to maintain as much backward compatibility as possible.
There was a problem hiding this comment.
Copy cannot be added back, since no useful file handles are Copy (without unsafe).
Eq/PartialEq might be possible to add back, but it would need a strange/custom implementation (ie, assigning the Term a unique id?), because neither of those traits is object safe:
error[E0038]: the trait `TermWrite` cannot be made into an object
--> src/term.rs:28:22
|
28 | write: Arc<Mutex<dyn TermWrite>>,
| ^^^^^^^^^^^^^ `TermWrite` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> src/term.rs:15:44
|
15 | trait TermWrite: Write + Debug + AsRawFd + PartialEq + Send {}
| --------- ^^^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
c016300 to
a29180f
Compare
This comment has been minimized.
This comment has been minimized.
b6e9aa7 to
76bc0a7
Compare
|
@pksunkara : Added an optional Also, the names of structs/methods continue to be completely open to change if you have any thoughts there. |
|
|
||
| /// Where the term is writing. | ||
| #[derive(Debug, Copy, Clone, PartialEq, Eq)] | ||
| #[derive(Debug, Clone)] |
There was a problem hiding this comment.
I would add it back to maintain as much backward compatibility as possible.
This branch updates the `console-subscriber` env var parsing code to accept durations with units. Durations may now be given in any of `ns`, `us`, `ms`, `s`, `sec`, `seconds`, `m`, `min`, `minutes`, `h`, or `hours`. Durations specified in seconds or a larger unit may also be given as fractional values, such as `1.5min`. As a follow-up, we may also want to allow specifying durations as a combination of multiple units, such as `3h15m`. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Fixes #34. Method and struct names are eminently bikesheddable.
Unfortunately there are some public API changes necessary: described inline.