/ohos5.0/commonlibrary/rust/ylong_runtime/ |
H A D | README_zh.md | 1 # ylong_runtime chapter 19 `ylong_runtime`为功能主体,用户使用时直接依赖该库即可。`ylong_runtime` 依赖以下三个 crates: 25 ### 图3 ylong_runtime 内部架构图 28 `ylong_runtime` 对外 API 分为四个模块: 48 ylong_runtime 60 |── ylong_runtime 92 1. 在 `Cargo.toml` 中引入 `ylong_runtime` 99 1. 在`bundle.json`中添加`ylong_runtime` 102 "components": ["ylong_runtime"] 105 2. 在`BUILD.gn`中添加`ylong_runtime:ylong_runtime` [all …]
|
H A D | README.md | 1 # ylong_runtime chapter 25 ### ylong_runtime framework 28 `ylong_runtime` external API is divided into four modules: 49 1. Introduce `ylong_runtime` in `Cargo.toml` 56 1. add `ylong_runtime` in bundle.json 60 "components": ["ylong_runtime"] 64 2. add `ylong_runtime:ylong_runtime` in `BUILD.gn` 67 external_deps = ["ylong_runtime:ylong_runtime"] 72 ylong_runtime 84 |── ylong_runtime [all …]
|
/ohos5.0/commonlibrary/rust/ylong_runtime/docs/ |
H A D | user_guide.md | 1 # ylong_runtime 用户指南 5 ylong_runtime 整体分为4个库: 9 - ylong_runtime: 异步调度框架库 30 let _ = ylong_runtime::block_on(fut); 70 let _ = ylong_runtime::block_on(fut); 81 use ylong_runtime::error::ErrorKind; 82 use ylong_runtime::time::sleep; 99 使用 ylong_runtime 中封装的异步IO(TCP/UDP)进行网络连接,相关接口定义位于模块 `ylong_runtime::net`. 103 use ylong_runtime::io::AsyncWrite; 159 use ylong_runtime::iter::prelude::*; [all …]
|
/ohos5.0/commonlibrary/rust/ylong_runtime/ylong_runtime/tests/ |
H A D | signal.rs | 23 use ylong_runtime::futures::poll_fn; 24 use ylong_runtime::signal::{signal, SignalKind}; 57 let _ = ylong_runtime::block_on(handle); in sdv_signal_recv_test() 101 let _ = ylong_runtime::block_on(handle); in sdv_signal_poll_recv_test() 141 let _ = ylong_runtime::block_on(handle); in sdv_signal_alarm() 156 let _ = ylong_runtime::block_on(handle); in sdv_signal_child() 171 let _ = ylong_runtime::block_on(handle); in sdv_signal_hangup() 186 let _ = ylong_runtime::block_on(handle); in sdv_signal_interrupt() 201 let _ = ylong_runtime::block_on(handle); in sdv_signal_io() 216 let _ = ylong_runtime::block_on(handle); in sdv_signal_pipe() [all …]
|
H A D | sync.rs | 65 ylong_runtime::block_on(async { in sdv_concurrency_with_mutex1() 72 ylong_runtime::spawn(async move { in sdv_concurrency_with_mutex1() 80 ylong_runtime::spawn(async move { in sdv_concurrency_with_mutex1() 88 ylong_runtime::spawn(async move { in sdv_concurrency_with_mutex1() 96 ylong_runtime::spawn(async move { in sdv_concurrency_with_mutex1() 123 ylong_runtime::block_on(async { in sdv_concurrency_with_mutex2() 148 ylong_runtime::block_on(async { in sdv_concurrency_with_mutex3() 209 ylong_runtime::block_on(async { in sdv_concurrency_with_mutex4() 360 ylong_runtime::block_on(async { in sdv_rwlock_read_and_write() 396 ylong_runtime::block_on(async { in sdv_rwlock_with_write1() [all …]
|
H A D | select.rs | 36 let handle = ylong_runtime::spawn(async { in sdv_new_select_basic() 38 ylong_runtime::select! { in sdv_new_select_basic() 68 let handle = ylong_runtime::spawn(async { in sdv_new_select_channel() 72 ylong_runtime::spawn(async move { in sdv_new_select_channel() 76 ylong_runtime::spawn(async move { in sdv_new_select_channel() 84 ylong_runtime::select! { in sdv_new_select_channel() 105 let handle = ylong_runtime::spawn(async { in sdv_new_select_biased() 109 ylong_runtime::select! { in sdv_new_select_biased() 160 ylong_runtime::select! { in sdv_new_select_match() 200 ylong_runtime::select! { in sdv_new_select_precondition() [all …]
|
H A D | async_buf_read.rs | 17 use ylong_runtime::net::{TcpListener, TcpStream}; 59 ylong_runtime::block_on(server).unwrap(); in sdv_buf_reader_read_until() 60 ylong_runtime::block_on(client).unwrap(); in sdv_buf_reader_read_until() 101 ylong_runtime::block_on(server).unwrap(); in sdv_buf_reader_read_line() 102 ylong_runtime::block_on(client).unwrap(); in sdv_buf_reader_read_line() 140 ylong_runtime::block_on(server).unwrap(); in sdv_buf_reader_split() 141 ylong_runtime::block_on(client).unwrap(); in sdv_buf_reader_split() 188 ylong_runtime::block_on(server).unwrap(); in sdv_buf_reader_lines() 189 ylong_runtime::block_on(client).unwrap(); in sdv_buf_reader_lines() 204 use ylong_runtime::fs::File; in sdv_buf_reader_seek() [all …]
|
H A D | async_fs.rs | 19 use ylong_runtime::fs::{File, OpenOptions}; 38 ylong_runtime::block_on(handle).unwrap(); in sdv_async_fs_write() 47 ylong_runtime::block_on(handle1).unwrap(); in sdv_async_fs_write() 73 ylong_runtime::block_on(handle).unwrap(); in sdv_async_fs_read() 82 ylong_runtime::block_on(handle2).unwrap(); in sdv_async_fs_read() 98 ylong_runtime::block_on(handle).unwrap(); in sdv_async_fs_rw() 118 ylong_runtime::block_on(handle).unwrap(); in sdv_async_fs_rw() 169 ylong_runtime::block_on(handle).unwrap(); in sdv_async_fs_read_to_end() 304 ylong_runtime::block_on(async { in sdv_async_fs_set_len() 324 ylong_runtime::block_on(async { in sdv_async_fs_try_clone() [all …]
|
H A D | async_buf_write.rs | 18 use ylong_runtime::net::{TcpListener, TcpStream}; 55 ylong_runtime::block_on(server).unwrap(); in sdv_buf_writer_write() 56 ylong_runtime::block_on(client).unwrap(); in sdv_buf_writer_write() 97 ylong_runtime::block_on(server).unwrap(); in sdv_buf_writer_write_vectored() 98 ylong_runtime::block_on(client).unwrap(); in sdv_buf_writer_write_vectored() 113 use ylong_runtime::fs::File; in sdv_buf_writer_seek() 114 use ylong_runtime::io::AsyncSeekExt; in sdv_buf_writer_seek() 123 ylong_runtime::block_on(handle).unwrap(); in sdv_buf_writer_seek() 193 ylong_runtime::block_on(server).unwrap(); in sdv_buf_writer_write_vectored_2() 194 ylong_runtime::block_on(client).unwrap(); in sdv_buf_writer_write_vectored_2() [all …]
|
H A D | mpsc_test.rs | 38 let _ = ylong_runtime::block_on(handle); in sdv_unbounded_send_recv_test() 57 let _ = ylong_runtime::block_on(handle); in sdv_unbounded_send_recv_drop_test() 93 let _ = ylong_runtime::block_on(handle); in sdv_unbounded_send_recv_timeout_test() 111 ylong_runtime::spawn(async move { in sdv_bounded_send_recv_test() 115 let _ = ylong_runtime::block_on(handle); in sdv_bounded_send_recv_test() 132 ylong_runtime::spawn(async move { in sdv_bounded_send_recv_drop_test() 136 let _ = ylong_runtime::block_on(handle); in sdv_bounded_send_recv_drop_test() 178 let _ = ylong_runtime::block_on(handle); in sdv_bounded_send_timeout_recv_timeout_test() 274 use ylong_runtime::task::JoinHandle; in sdv_multi_send_recv_test() 292 let _ = ylong_runtime::block_on(t); in sdv_multi_send_recv_test() [all …]
|
H A D | udp_test.rs | 18 use ylong_runtime::net::UdpSocket; 31 let handle = ylong_runtime::spawn(async { in sdv_udp_send_recv() 69 let handle = ylong_runtime::spawn(async { in sdv_udp_send_to_recv_from() 99 let handle = ylong_runtime::spawn(async move { in sdv_udp_recv() 143 let handle = ylong_runtime::spawn(async move { in sdv_udp_try_recv_from() 180 let handle = ylong_runtime::spawn(async move { in sdv_udp_try_send() 202 let handle = ylong_runtime::spawn(async move { in sdv_udp_try_recv() 240 ylong_runtime::block_on(async { in sdv_udp_block_on_try_recv() 348 let handle = ylong_runtime::spawn(async { in sdv_send_to_try_peek_from() 485 ylong_runtime::block_on(async { in sdv_udp_basic_v4() [all …]
|
H A D | process.rs | 29 let handle = ylong_runtime::spawn(async { in sdv_process_output_test() 38 ylong_runtime::block_on(handle).unwrap(); in sdv_process_output_test() 48 let handle = ylong_runtime::spawn(async { in sdv_process_status_test() 55 ylong_runtime::block_on(handle).unwrap(); in sdv_process_status_test() 66 let handle = ylong_runtime::spawn(async { in sdv_process_spawn_test() 80 ylong_runtime::block_on(handle).unwrap(); in sdv_process_spawn_test() 92 let handle = ylong_runtime::spawn(async { in sdv_process_child_stdio_test() 129 ylong_runtime::block_on(handle).unwrap(); in sdv_process_child_stdio_test() 140 let handle = ylong_runtime::spawn(async { in sdv_process_kill_test() 147 ylong_runtime::block_on(handle).unwrap(); in sdv_process_kill_test() [all …]
|
H A D | tcp_test.rs | 17 use ylong_runtime::net::{TcpListener, TcpStream}; 30 let handle = ylong_runtime::spawn(async move { in sdv_tcp_ipv6_connect() 50 ylong_runtime::block_on(handle).unwrap(); in sdv_tcp_ipv6_connect() 61 let handle = ylong_runtime::spawn(async { in sdv_tcp_listener_interface() 69 ylong_runtime::block_on(handle).unwrap(); in sdv_tcp_listener_interface() 103 ylong_runtime::block_on(handle).unwrap(); in sdv_tcp_stream_try() 151 ylong_runtime::block_on(handle).unwrap(); in sdv_tcp_stream_basic() 163 let handle = ylong_runtime::spawn(async { in sdv_tcp_stream_peek() 186 ylong_runtime::block_on(handle).unwrap(); in sdv_tcp_stream_peek() 342 ylong_runtime::block_on(async move { in sdv_tcp_address_in_use() [all …]
|
H A D | spawn.rs | 36 handles.push(ylong_runtime::spawn(test_future(i))); in sdv_one_core_test() 40 let ret = ylong_runtime::block_on(handle); in sdv_one_core_test() 53 handles.push(ylong_runtime::spawn(test_future(i))); in sdv_two_core_test() 57 let ret = ylong_runtime::block_on(handle); in sdv_two_core_test() 70 handles.push(ylong_runtime::spawn(test_future(i))); in sdv_three_core_test() 74 let ret = ylong_runtime::block_on(handle); in sdv_three_core_test() 91 let ret = ylong_runtime::block_on(handle); in sdv_four_core_test() 108 let ret = ylong_runtime::block_on(handle); in sdv_eight_core_test() 125 let ret = ylong_runtime::block_on(handle); in sdv_max_core_test() 142 let ret = ylong_runtime::block_on(handle); in sdv_multi_future_in_async() [all …]
|
H A D | uds_test.rs | 72 ylong_runtime::block_on(server()); in sdv_uds_stream_test() 73 ylong_runtime::block_on(handle).unwrap(); in sdv_uds_stream_test() 117 ylong_runtime::block_on(server()); in sdv_uds_datagram_test() 118 ylong_runtime::block_on(handle).unwrap(); in sdv_uds_datagram_test() 135 let handle = ylong_runtime::spawn(async { in sdv_uds_stream_try_test() 162 ylong_runtime::block_on(handle).unwrap(); in sdv_uds_stream_try_test() 177 let handle = ylong_runtime::spawn(async { in sdv_uds_datagram_try_test() 204 ylong_runtime::block_on(handle).unwrap(); in sdv_uds_datagram_try_test() 221 let handle = ylong_runtime::spawn(async { in sdv_uds_listener_baisc_test() 228 ylong_runtime::block_on(handle).unwrap(); in sdv_uds_listener_baisc_test() [all …]
|
H A D | join_set.rs | 24 use ylong_runtime::error::ErrorKind; 25 use ylong_runtime::task::{JoinSet, Qos}; 27 use ylong_runtime::time::sleep; 125 ylong_runtime::block_on(handle).unwrap(); in sdv_join_set_spawn_io() 147 ylong_runtime::block_on(handle).unwrap(); in sdv_join_set_spawn_multiple() 163 ylong_runtime::block_on(async move { in sdv_join_set_join_all() 191 ylong_runtime::block_on(async move { in sdv_join_set_cancel_one() 219 ylong_runtime::block_on(async move { in sdv_join_set_cancel_all() 244 ylong_runtime::block_on(async move { in sdv_join_set_builder() 270 ylong_runtime::block_on(async move { in sdv_join_set_shutdown() [all …]
|
H A D | task_cancel.rs | 21 use ylong_runtime::error::ErrorKind; 22 use ylong_runtime::time::sleep; 34 let handle = ylong_runtime::spawn(async move { in sdv_task_cancel_simple() 35 let task = ylong_runtime::spawn(async move { in sdv_task_cancel_simple() 43 ylong_runtime::block_on(handle).unwrap(); in sdv_task_cancel_simple() 56 let handle = ylong_runtime::spawn(async move { in sdv_task_cancel_failed() 57 let task = ylong_runtime::spawn(async move { 1 }); in sdv_task_cancel_failed() 63 ylong_runtime::block_on(handle).unwrap(); in sdv_task_cancel_failed() 94 ylong_runtime::block_on(async move { in sdv_task_cancel_multiple() 95 let handle = ylong_runtime::spawn(async move { in sdv_task_cancel_multiple()
|
H A D | semaphore_test.rs | 17 use ylong_runtime::sync::{AutoRelSemaphore, Semaphore}; 18 use ylong_runtime::task::JoinHandle; 31 let handle = ylong_runtime::spawn(async move { in sdv_auto_release_sem_acquire_test() 35 ylong_runtime::block_on(handle).expect("block_on failed"); in sdv_auto_release_sem_acquire_test() 88 let handle = ylong_runtime::spawn(async move { in sdv_auto_release_sem_close_test() 108 tasks.push(ylong_runtime::spawn(async move { in sdv_auto_release_sem_stress_test() 113 let _ = ylong_runtime::block_on(t); in sdv_auto_release_sem_stress_test() 143 tasks.push(ylong_runtime::spawn(async move { in sdv_async_stress_test() 146 tasks.push(ylong_runtime::spawn(async move { in sdv_async_stress_test() 151 let _ = ylong_runtime::block_on(t); in sdv_async_stress_test() [all …]
|
H A D | singleton_runtime.rs | 14 use ylong_runtime::builder::RuntimeBuilder; 15 use ylong_runtime::task::TaskBuilder; 17 use ylong_runtime::time; 50 handles.push(ylong_runtime::spawn(test_async_in_async(i, i + 1))); in sdv_concurrently_runtime_spawn_async_in_async_task() 53 let ret = ylong_runtime::block_on(handle); in sdv_concurrently_runtime_spawn_async_in_async_task() 78 handles.push(ylong_runtime::spawn(test_async_in_async(i, i + 1))); in sdv_concurrently_spawn_async_in_async_task() 81 let ret = ylong_runtime::block_on(handle); in sdv_concurrently_spawn_async_in_async_task() 110 let ret = ylong_runtime::block_on(handle); in sdv_concurrently_task_builder_spawn_async_in_async_task() 131 let ret = ylong_runtime::block_on(async move { in sdv_global_block_on() 146 let _ = ylong_runtime::block_on(ylong_runtime::spawn(async move { 1 })); in sdv_build_global_failed()
|
H A D | timer_test.rs | 21 use ylong_runtime::time::{sleep, sleep_until, Sleep}; 42 handles.push(ylong_runtime::spawn(async move { in simulate() 59 ylong_runtime::block_on(simulate()); in sdv_multi_timer() 71 let handle = ylong_runtime::spawn(async move { sleep_until(Instant::now()) }); in sdv_sleep_drop_out_context() 72 let timer = ylong_runtime::block_on(handle).unwrap(); in sdv_sleep_drop_out_context() 84 use ylong_runtime::time::timeout; in sdv_block_on_timeout() 87 ylong_runtime::block_on( in sdv_block_on_timeout() 125 let handle = ylong_runtime::spawn(async move { in sdv_sleep_poll() 136 let ret = ylong_runtime::block_on(handle).unwrap(); in sdv_sleep_poll()
|
H A D | async_read.rs | 18 use ylong_runtime::io::{AsyncBufReader, AsyncReadExt, AsyncWriteExt}; 19 use ylong_runtime::net::{TcpListener, TcpStream}; 31 ylong_runtime::block_on(async move { in sdv_async_read_slice() 63 let server = ylong_runtime::spawn(async move { in sdv_buf_reader_read_to_string() 74 let client = ylong_runtime::spawn(async move { in sdv_buf_reader_read_to_string() 85 ylong_runtime::block_on(server).unwrap(); in sdv_buf_reader_read_to_string() 86 ylong_runtime::block_on(client).unwrap(); in sdv_buf_reader_read_to_string()
|
/ohos5.0/commonlibrary/rust/ylong_runtime/ylong_runtime/benches/ |
H A D | ylong_tokio_rwlock.rs | 35 use ylong_runtime::sync::rwlock::RwLock as YlongRwlock; 74 let handle = ylong_runtime::spawn(async move {}); in ylong_rwlock_read() 75 let _ = ylong_runtime::block_on(handle); in ylong_rwlock_read() 86 ylong_runtime::block_on(handler).unwrap(); in ylong_rwlock_read() 123 let handle = ylong_runtime::spawn(async move {}); in ylong_rwlock_write() 124 let _ = ylong_runtime::block_on(handle); in ylong_rwlock_write() 135 ylong_runtime::block_on(handler).unwrap(); in ylong_rwlock_write() 180 let handle = ylong_runtime::spawn(async move {}); in ylong_rwlock_write_read() 181 let _ = ylong_runtime::block_on(handle); in ylong_rwlock_write_read() 195 handlers.push(ylong_runtime::spawn(ylong_rwlock_task(lock_in))); in ylong_rwlock_write_read() [all …]
|
/ohos5.0/commonlibrary/rust/ylong_runtime/ylong_runtime/examples/ |
H A D | ylong_runtime_timer_memory.rs | 16 use ylong_runtime::block_on; 17 use ylong_runtime::builder::RuntimeBuilder; 23 ylong_runtime::time::sleep(Duration::from_secs_f32(0.5)).await; in read_big_data() 24 ylong_runtime::time::sleep(Duration::from_secs_f32(30.0)).await; in read_big_data() 30 ylong_runtime::spawn(async { in run_forever() 32 ylong_runtime::time::timeout(Duration::from_secs(1), read_big_data()).await in run_forever() 39 ylong_runtime::time::sleep(Duration::from_secs_f32(0.1)).await; in run_forever() 50 ylong_runtime::spawn(async { run_forever().await }); in main()
|
/ohos5.0/commonlibrary/rust/ylong_runtime/test/ |
H A D | BUILD.gn | 17 module_out_path = "ylong_runtime/ylong_runtime" 29 sources = [ "../ylong_runtime/src/lib.rs" ] 39 module_out_path = "ylong_runtime/ylong_runtime" 52 sources = [ "../ylong_runtime/tests/entry.rs" ] 54 "../ylong_runtime:ylong_runtime", 60 module_out_path = "ylong_runtime/ylong_runtime"
|
/ohos5.0/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/uploader/ |
H A D | mod.rs | 204 use ylong_runtime::io::AsyncRead; 219 let handle = ylong_runtime::spawn(async move { in ut_upload() 222 ylong_runtime::block_on(handle).unwrap(); in ut_upload() 232 let mut buf = ylong_runtime::io::ReadBuf::new(user_slice.as_mut_slice()); in upload() 233 ylong_runtime::futures::poll_fn(|cx| Pin::new(&mut uploader).poll_read(cx, &mut buf)) in upload() 247 let mut buf = ylong_runtime::io::ReadBuf::new(user_slice.as_mut_slice()); in upload() 263 let handle = ylong_runtime::spawn(async move { in ut_upload_op_cov() 266 ylong_runtime::block_on(handle).unwrap(); in ut_upload_op_cov() 296 let handle = ylong_runtime::spawn(async { upload_and_show_progress().await }); in ut_uploader_builder() 297 ylong_runtime::block_on(handle).unwrap(); in ut_uploader_builder() [all …]
|