mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
wallet: ExecutorPtr = Arc<smol::Executor<'static>>
This commit is contained in:
@@ -29,6 +29,7 @@ use crate::{
|
||||
scene::{MethodResponseFn, Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId, SceneNodeType},
|
||||
text2::TextShaperPtr,
|
||||
ui::{chatview, Button, ChatView, EditBox, Image, Mesh, RenderLayer, Stoppable, Text, Window},
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
//fn print_type_of<T>(_: &T) {
|
||||
@@ -52,12 +53,12 @@ pub struct AsyncRuntime {
|
||||
signal: smol::channel::Sender<()>,
|
||||
shutdown: smol::channel::Receiver<()>,
|
||||
exec_threadpool: std::sync::Mutex<Option<thread::JoinHandle<()>>>,
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
tasks: std::sync::Mutex<Vec<smol::Task<()>>>,
|
||||
}
|
||||
|
||||
impl AsyncRuntime {
|
||||
pub fn new(ex: Arc<smol::Executor<'static>>) -> Self {
|
||||
pub fn new(ex: ExecutorPtr) -> Self {
|
||||
let (signal, shutdown) = smol::channel::unbounded::<()>();
|
||||
|
||||
Self {
|
||||
@@ -117,7 +118,7 @@ impl AsyncRuntime {
|
||||
|
||||
pub struct App {
|
||||
sg: SceneGraphPtr2,
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
render_api: RenderApiPtr,
|
||||
event_pub: GraphicsEventPublisherPtr,
|
||||
text_shaper: TextShaperPtr,
|
||||
@@ -126,7 +127,7 @@ pub struct App {
|
||||
impl App {
|
||||
pub fn new(
|
||||
sg: SceneGraphPtr2,
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
render_api: RenderApiPtr,
|
||||
event_pub: GraphicsEventPublisherPtr,
|
||||
text_shaper: TextShaperPtr,
|
||||
|
||||
@@ -56,6 +56,8 @@ mod util;
|
||||
|
||||
use crate::{net::ZeroMQAdapter, scene::SceneGraph, text2::TextShaper};
|
||||
|
||||
pub type ExecutorPtr = Arc<smol::Executor<'static>>;
|
||||
|
||||
fn panic_hook(panic_info: &std::panic::PanicInfo) {
|
||||
error!("panic occurred: {panic_info}");
|
||||
//error!("panic: {}", std::backtrace::Backtrace::force_capture().to_string());
|
||||
|
||||
@@ -29,6 +29,7 @@ use crate::{
|
||||
expr::SExprCode,
|
||||
prop::{Property, PropertySubType, PropertyType, PropertyValue, Role},
|
||||
scene::{SceneGraphPtr2, SceneNodeId, SceneNodeType, Slot, SlotId},
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
#[derive(Debug, SerialDecodable)]
|
||||
@@ -77,14 +78,14 @@ pub struct ZeroMQAdapter {
|
||||
slot_recvr: Option<mpsc::Receiver<(Vec<u8>, Vec<u8>)>>,
|
||||
*/
|
||||
scene_graph: SceneGraphPtr2,
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
|
||||
zmq_rep: Mutex<zeromq::RepSocket>,
|
||||
zmq_pub: Mutex<zeromq::PubSocket>,
|
||||
}
|
||||
|
||||
impl ZeroMQAdapter {
|
||||
pub async fn new(scene_graph: SceneGraphPtr2, ex: Arc<smol::Executor<'static>>) -> Arc<Self> {
|
||||
pub async fn new(scene_graph: SceneGraphPtr2, ex: ExecutorPtr) -> Arc<Self> {
|
||||
let mut zmq_rep = zeromq::RepSocket::new();
|
||||
zmq_rep.bind("tcp://0.0.0.0:9484").await.unwrap();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ use crate::{
|
||||
prop::{PropertyBool, PropertyPtr, PropertyUint32, Role},
|
||||
pubsub::Subscription,
|
||||
scene::{Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId, Signal},
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
use super::{eval_rect, get_parent_rect, read_rect, DrawUpdate, OnModify, Stoppable};
|
||||
@@ -50,7 +51,7 @@ pub struct Button {
|
||||
|
||||
impl Button {
|
||||
pub async fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
sg: SceneGraphPtr2,
|
||||
node_id: SceneNodeId,
|
||||
event_pub: GraphicsEventPublisherPtr,
|
||||
|
||||
@@ -44,6 +44,7 @@ use crate::{
|
||||
scene::{Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId},
|
||||
text2::{self, Glyph, GlyphPositionIter, SpritePtr, TextShaper, TextShaperPtr},
|
||||
util::zip3,
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
use super::{eval_rect, get_parent_rect, read_rect, DrawUpdate, OnModify, Stoppable};
|
||||
@@ -259,7 +260,7 @@ pub struct ChatView {
|
||||
|
||||
impl ChatView {
|
||||
pub async fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
sg: SceneGraphPtr2,
|
||||
node_id: SceneNodeId,
|
||||
render_api: RenderApiPtr,
|
||||
@@ -613,7 +614,7 @@ impl ChatView {
|
||||
None => {
|
||||
//debug!(target: "ui::chatview", "no page found");
|
||||
0
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
let page = &mut pages[idx];
|
||||
|
||||
@@ -42,6 +42,7 @@ use crate::{
|
||||
scene::{Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId},
|
||||
text2::{self, Glyph, GlyphPositionIter, SpritePtr, TextShaper, TextShaperPtr},
|
||||
util::zip3,
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
use super::{eval_rect, get_parent_rect, read_rect, DrawUpdate, OnModify, Stoppable};
|
||||
@@ -167,7 +168,7 @@ pub struct EditBox {
|
||||
|
||||
impl EditBox {
|
||||
pub async fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
sg: SceneGraphPtr2,
|
||||
node_id: SceneNodeId,
|
||||
render_api: RenderApiPtr,
|
||||
|
||||
@@ -35,6 +35,7 @@ use crate::{
|
||||
scene::{Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId},
|
||||
text2::{self, Glyph, GlyphPositionIter, SpritePtr, TextShaper, TextShaperPtr},
|
||||
util::zip3,
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
use super::{eval_rect, get_parent_rect, read_rect, DrawUpdate, OnModify, Stoppable};
|
||||
@@ -58,7 +59,7 @@ pub struct Image {
|
||||
|
||||
impl Image {
|
||||
pub async fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
sg: SceneGraphPtr2,
|
||||
node_id: SceneNodeId,
|
||||
render_api: RenderApiPtr,
|
||||
|
||||
@@ -24,6 +24,7 @@ use crate::{
|
||||
gfx2::{DrawCall, DrawInstruction, Rectangle, RenderApiPtr},
|
||||
prop::{PropertyBool, PropertyPtr, Role},
|
||||
scene::{Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId},
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
use super::{eval_rect, get_parent_rect, read_rect, DrawUpdate, OnModify, Stoppable};
|
||||
@@ -46,7 +47,7 @@ pub struct RenderLayer {
|
||||
|
||||
impl RenderLayer {
|
||||
pub async fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
sg_ptr: SceneGraphPtr2,
|
||||
node_id: SceneNodeId,
|
||||
render_api: RenderApiPtr,
|
||||
|
||||
@@ -23,6 +23,7 @@ use crate::{
|
||||
gfx2::{DrawCall, DrawInstruction, DrawMesh, Rectangle, RenderApiPtr, Vertex},
|
||||
prop::{PropertyPtr, PropertyUint32, Role},
|
||||
scene::{Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId},
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
use super::{eval_rect, get_parent_rect, read_rect, DrawUpdate, OnModify, Stoppable};
|
||||
@@ -48,7 +49,7 @@ pub struct Mesh {
|
||||
|
||||
impl Mesh {
|
||||
pub async fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
sg: SceneGraphPtr2,
|
||||
node_id: SceneNodeId,
|
||||
render_api: RenderApiPtr,
|
||||
|
||||
@@ -25,6 +25,7 @@ use crate::{
|
||||
gfx2::{DrawCall, Rectangle},
|
||||
prop::{PropertyPtr, Role},
|
||||
scene::{SceneGraph, SceneNode, SceneNodeId, SceneNodeType},
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
mod button;
|
||||
@@ -56,7 +57,7 @@ pub struct DrawUpdate {
|
||||
}
|
||||
|
||||
pub struct OnModify<T> {
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
node_name: String,
|
||||
node_id: SceneNodeId,
|
||||
me: Weak<T>,
|
||||
@@ -64,12 +65,7 @@ pub struct OnModify<T> {
|
||||
}
|
||||
|
||||
impl<T: Send + Sync + 'static> OnModify<T> {
|
||||
pub fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
node_name: String,
|
||||
node_id: SceneNodeId,
|
||||
me: Weak<T>,
|
||||
) -> Self {
|
||||
pub fn new(ex: ExecutorPtr, node_name: String, node_id: SceneNodeId, me: Weak<T>) -> Self {
|
||||
Self { ex, node_name, node_id, me, tasks: vec![] }
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ use crate::{
|
||||
scene::{Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId},
|
||||
text2::{self, Glyph, GlyphPositionIter, SpritePtr, TextShaper, TextShaperPtr},
|
||||
util::zip3,
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
use super::{eval_rect, get_parent_rect, read_rect, DrawUpdate, OnModify, Stoppable};
|
||||
@@ -65,7 +66,7 @@ pub struct Text {
|
||||
|
||||
impl Text {
|
||||
pub async fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
sg: SceneGraphPtr2,
|
||||
node_id: SceneNodeId,
|
||||
render_api: RenderApiPtr,
|
||||
|
||||
@@ -22,6 +22,7 @@ use crate::{
|
||||
gfx2::{DrawCall, GraphicsEventPublisherPtr, Rectangle, RenderApiPtr},
|
||||
prop::{PropertyPtr, Role},
|
||||
scene::{Pimpl, SceneGraph, SceneGraphPtr2, SceneNodeId},
|
||||
ExecutorPtr,
|
||||
};
|
||||
|
||||
use super::{OnModify, Stoppable};
|
||||
@@ -39,7 +40,7 @@ pub struct Window {
|
||||
|
||||
impl Window {
|
||||
pub async fn new(
|
||||
ex: Arc<smol::Executor<'static>>,
|
||||
ex: ExecutorPtr,
|
||||
sg: SceneGraphPtr2,
|
||||
node_id: SceneNodeId,
|
||||
render_api: RenderApiPtr,
|
||||
|
||||
Reference in New Issue
Block a user