How do I convert RC<RefCell<DrawingBackendImpl>>
to DrawingArea
?
#323
Replies: 4 comments 1 reply
-
Hi @DaMilyutin, This error is telling you that in order to call The You seem to need a As Hope this helps :) |
Beta Was this translation helpful? Give feedback.
-
@414owen, (I've deleted my useless comments above). First, you were right about borrow_mut().
Just borrow_mut couldn't help bacause there can be only one mutating reference. What I'm going to play is make dashed, dotted lines and gradient lines. Thank you for your help. I was quite desperate. |
Beta Was this translation helpful? Give feedback.
-
Congrats @DaMilyutin, it looks good! To be honest, I'd only made a small PR to |
Beta Was this translation helpful? Give feedback.
-
Hi, I have such problem
I have no idea how to fix it.
I need both backend and root.
I see trait From for Rc<RefCel> (which is stored in DrawingArea)
But by some reason
.into()
is not seen for it.Error message:
"
error[E0599]: the method
into_drawing_area
exists for structRc<RefCell<plotters::prelude::BitMapBackend<'_>>>
, but its trait bounds were not satisfied--> src\main.rs:46:24
|
46 | let root = backend.into_drawing_area();
| ^^^^^^^^^^^^^^^^^ method cannot be called on
Rc<RefCell<plotters::prelude::BitMapBackend<'_>>>
due to unsatisfied trait bounds|
::: C:\Users\58.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\cell.rs:603:1
|
603 | pub struct RefCell<T: ?Sized> {
| -----------------------------
| |
| doesn't satisfy
_: plotters::drawing::IntoDrawingArea
| doesn't satisfy
_: plotters_backend::DrawingBackend
|
::: C:\Users\58.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\rc.rs:309:1
|
309 | pub struct Rc<T: ?Sized> {
| ------------------------
| |
| doesn't satisfy
_: plotters::drawing::IntoDrawingArea
| doesn't satisfy
_: plotters_backend::DrawingBackend
|
= note: the following trait bounds were not satisfied:
Rc<RefCell<plotters::prelude::BitMapBackend<'_>>>: plotters_backend::DrawingBackend
which is required by
Rc<RefCell<plotters::prelude::BitMapBackend<'_>>>: plotters::drawing::IntoDrawingArea
&Rc<RefCell<plotters::prelude::BitMapBackend<'_>>>: plotters_backend::DrawingBackend
which is required by
&Rc<RefCell<plotters::prelude::BitMapBackend<'_>>>: plotters::drawing::IntoDrawingArea
&mut Rc<RefCell<plotters::prelude::BitMapBackend<'_>>>: plotters_backend::DrawingBackend
which is required by
&mut Rc<RefCell<plotters::prelude::BitMapBackend<'_>>>: plotters::drawing::IntoDrawingArea
RefCell<plotters::prelude::BitMapBackend<'_>>: plotters_backend::DrawingBackend
which is required by
RefCell<plotters::prelude::BitMapBackend<'_>>: plotters::drawing::IntoDrawingArea
&RefCell<plotters::prelude::BitMapBackend<'_>>: plotters_backend::DrawingBackend
which is required by
&RefCell<plotters::prelude::BitMapBackend<'_>>: plotters::drawing::IntoDrawingArea
&mut RefCell<plotters::prelude::BitMapBackend<'_>>: plotters_backend::DrawingBackend
which is required by
&mut RefCell<plotters::prelude::BitMapBackend<'_>>: plotters::drawing::IntoDrawingArea
"
Beta Was this translation helpful? Give feedback.
All reactions