/commonlibrary/rust/ylong_runtime/ylong_runtime/src/util/ |
H A D | bit.rs | 28 /// let mask = Mask::new(4, 0); 52 /// let mask = Mask::new(width, shift); 57 /// let mask = Mask::new(width, shift); 67 /// let mask = Mask::new(width, shift); 76 /// let mask = Mask::new(width, shift); 87 /// let mask = Mask::new(width, shift); 91 pub const fn new(width: u32, shift: u32) -> Self { 130 /// const A: Mask = Mask::new(16, 48); 131 /// const B: Mask = Mask::new(16, 32); 132 /// const C: Mask = Mask::new(1 [all...] |
/commonlibrary/rust/ylong_json/src/reader/ |
H A D | io_reader.rs | 26 /// let mut io_reader = IoReader::new(file); 46 /// Create a new `Cache`. 47 fn new() -> Self { in new() functions 49 cache: Vec::new(), in new() 56 /// Create a new `IoReader` from the given I\O. 57 pub(crate) fn new(io: R) -> Self { 63 pos: Position::new(1, 1), 193 let mut cache = Cache::new(); in start_caching() 236 fn new(vec: Vec<u8>) -> Self { in new() functions 259 fn new() functions 281 fn new() -> Self { new() functions [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/ |
H A D | pool.rs | 52 pub(crate) fn new(config: HttpConfig, connector: C) -> Self { 54 pool: Pool::new(), 56 alt_svcs: AltServiceMap::new(), 57 connector: Arc::new(connector), 63 let key = PoolKey::new( 72 .get(key, Conns::new) 98 fn new() -> Self { in new() functions 100 list: Arc::new(Mutex::new(Vec::new())), in new() [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/net/ |
H A D | driver.rs | 48 const GENERATION: Mask = Mask::new(7, 24); 49 const ADDRESS: Mask = Mask::new(24, 0); 90 fn new(inner: Arc<Inner>) -> Self { in new() functions 102 fn new(inner: Arc<Inner>, waker: ylong_io::Waker) -> Self { in new() functions 139 /// when new slabs gets inserted 198 Poll::new().unwrap_or_else(|e| panic!("IO poller initialize failed, error: {e}")); 199 let waker = ylong_io::Waker::new(&poll, WAKE_TOKEN) 201 let arc_poll = Arc::new(poll); 203 let slab = Slab::new(); 205 let inner = Arc::new(Inne [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/tests/ |
H A D | semaphore_test.rs | 29 let sem = Arc::new(AutoRelSemaphore::new(1).unwrap()); in sdv_auto_release_sem_acquire_test() 49 let sem = AutoRelSemaphore::new(1).unwrap(); in sdv_auto_release_sem_try_acquire_test() 67 let sem = Semaphore::new(2).unwrap(); in sdv_release_test() 81 let sem = Arc::new(AutoRelSemaphore::new(2).unwrap()); in sdv_auto_release_sem_close_test() 103 let sem = Arc::new(AutoRelSemaphore::new(5).unwrap()); in sdv_auto_release_sem_stress_test() 104 let mut tasks: Vec<JoinHandle<()>> = Vec::new(); in sdv_auto_release_sem_stress_test() 138 let mut tasks: Vec<JoinHandle<()>> = Vec::new(); in sdv_async_stress_test() [all...] |
H A D | pty_process.rs | 31 let mut command = PtyCommand::new("echo"); in sdv_pty_process_test() 41 assert_eq!(envs, &[(OsStr::new("PATH"), Some(OsStr::new("/bin")))]); in sdv_pty_process_test() 45 assert_eq!(envs, &[(OsStr::new("PATH"), None)]); in sdv_pty_process_test() 51 let envs = [(OsStr::new("TZ"), OsStr::new("test"))]; in sdv_pty_process_test() 54 assert_eq!(envs, &[(OsStr::new("TZ"), Some(OsStr::new("test")))]); in sdv_pty_process_test() 61 assert_eq!(command.get_current_dir(), Some(Path::new("/bin"))); in sdv_pty_process_test() 77 let mut pty = Pty::new() in sdv_pty_process_read_and_write_test() [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/uploader/ |
H A D | mod.rs | 107 UploaderBuilder::new().reader(reader).console().build() in console() 122 UploaderBuilder::new() in builder() 139 this.info = Some(UploadInfo::new()); in poll_read() 144 match Pin::new(&mut this.operator).poll_progress( in poll_read() 152 return Poll::Ready(Err(std::io::Error::new( in poll_read() 154 Box::new(e), in poll_read() 160 Pin::new(&mut this.reader).poll_read(cx, buf) in poll_read() 196 fn new() -> Self { in new() functions 232 let mut buf = ylong_runtime::io::ReadBuf::new(user_slice.as_mut_slice()); 233 ylong_runtime::futures::poll_fn(|cx| Pin::new( [all...] |
/commonlibrary/rust/ylong_json/tests/ |
H A D | ylong_json_sdv_test.rs | 207 assert_eq!($json[4]["array1"], Array::new().into()); 208 assert_eq!($json[4]["array2"], Array::new().into()); 213 assert_eq!($json[4]["array3"][4], Array::new().into()); 214 assert_eq!($json[4]["array3"][5], Object::new().into()); 219 assert_eq!($json[4]["array4"][4], Array::new().into()); 220 assert_eq!($json[4]["array4"][5], Object::new().into()); 222 assert_eq!($json[5]["object1"], Object::new().into()); 223 assert_eq!($json[5]["object2"], Object::new().into()); 228 assert_eq!($json[5]["object3"]["key5"], Array::new().into()); 229 assert_eq!($json[5]["object3"]["key6"], Object::new() [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/sync_impl/ |
H A D | pool.rs | 32 pub(crate) fn new(connector: C) -> Self { 34 pool: Pool::new(), 35 connector: Arc::new(connector), 40 let key = PoolKey::new( 46 .get(key, Conns::new) 56 fn new() -> Self { in new() functions 58 list: Arc::new(Mutex::new(Vec::new())), in new()
|
H A D | client.rs | 36 /// // Creates a new `Client`. 37 /// let client = Client::new(); 39 /// // Creates a new `Request`. 40 /// let request = Request::new(EmptyBody); 54 /// Creates a new, default `Client`, which uses 64 /// let client = Client::new(); 66 pub fn new() -> Self { in new() functions 70 /// Creates a new, default [`sync_impl::ClientBuilder`]. 82 ClientBuilder::new() in builder() 87 /// Creates a new, defaul 208 pub fn new() -> Self { new() functions [all...] |
/commonlibrary/rust/ylong_http/ylong_http/src/h2/ |
H A D | pseudo.rs | 32 /// Create a new `PseudoHeaders`. 33 pub(crate) fn new() -> Self { 154 PseudoHeaders::new() in default() 162 /// UT test cases for `PseudoHeaders::new`. 165 /// 1. Calls `PseudoHeaders::new` to create a `PseudoHeaders`. 169 let pseudo = PseudoHeaders::new(); in ut_pseudo_headers_new() 187 let mut pseudo = PseudoHeaders::new(); in ut_pseudo_headers_contains_authority() 203 let mut pseudo = PseudoHeaders::new(); in ut_pseudo_headers_authority() 219 let mut pseudo = PseudoHeaders::new(); in ut_pseudo_headers_set_authority() 239 let mut pseudo = PseudoHeaders::new(); in ut_pseudo_headers_take_authority() [all...] |
H A D | frame.rs | 209 /// Constructs a new `Frame` with the given `StreamId`, `FrameFlags`, 211 pub fn new(id: StreamId, flags: FrameFlags, payload: Payload) -> Self { in new() functions 233 /// Creates a new `FrameFlags` instance with the given `flags` byte. 234 pub fn new(flags: u8) -> Self { in new() functions 238 /// Creates a new `FrameFlags` instance with no flags set. 326 /// Creates a new Headers instance from the provided Parts. 327 pub fn new(parts: Parts) -> Self { in new() functions 343 /// Creates a new Data instance containing the provided data. 344 pub fn new(data: Vec<u8>) -> Self { in new() functions 360 /// Creates a new Setting 361 pub fn new(settings: Vec<Setting>) -> Self { new() functions 418 pub fn new() -> Self { new() functions 479 pub fn new(error_code: u32, last_stream_id: StreamId, debug_data: Vec<u8>) -> Self { new() functions 512 pub fn new(window_size_increment: u32) -> Self { new() functions 532 pub fn new(exclusive: bool, stream_dependency: u32, weight: u8) -> Self { new() functions 558 pub fn new(error_code: u32) -> Self { new() functions 583 pub fn new(data: [u8; 8]) -> Self { new() functions 600 pub fn new(promised_stream_id: StreamId, parts: Parts) -> Self { new() functions [all...] |
/commonlibrary/rust/ylong_http/ylong_http/src/h3/ |
H A D | pseudo.rs | 31 /// Create a new `PseudoHeaders`. 32 pub(crate) fn new() -> Self { 153 PseudoHeaders::new() in default() 161 /// UT test cases for `PseudoHeaders::new`. 164 /// 1. Calls `PseudoHeaders::new` to create a `PseudoHeaders`. 168 let pseudo = PseudoHeaders::new(); in ut_pseudo_headers_new() 186 let mut pseudo = PseudoHeaders::new(); in ut_pseudo_headers_contains_authority() 202 let mut pseudo = PseudoHeaders::new(); in ut_pseudo_headers_authority() 218 let mut pseudo = PseudoHeaders::new(); in ut_pseudo_headers_set_authority() 238 let mut pseudo = PseudoHeaders::new(); in ut_pseudo_headers_take_authority() [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/sync/ |
H A D | rwlock.rs | 41 /// let lock = RwLock::new(0); 69 /// Creates a new RwLock. `T` is the data that needs to be protected 77 /// let lock = RwLock::new(0); 79 pub fn new(t: T) -> RwLock<T> { in new() functions 82 read_sem: SemaphoreInner::new(0).unwrap(), in new() 83 write_sem: SemaphoreInner::new(0).unwrap(), in new() 84 write_mutex: SemaphoreInner::new(1).unwrap(), in new() 85 read_count: AtomicI64::new(0), in new() 86 read_wait: AtomicI64::new(0), in new() 87 data: UnsafeCell::new( in new() [all...] |
H A D | mutex.rs | 65 /// let _a = Mutex::new(2); 67 pub fn new(t: T) -> Mutex<T> { in new() functions 70 sem: SemaphoreInner::new(1).unwrap(), in new() 71 data: UnsafeCell::new(t), in new() 90 /// let lock = Arc::new(Mutex::new(2)); 116 /// let mutex = Arc::new(Mutex::new(0)); 195 /// UT test cases for Mutex::new() interface 203 let lock = Mutex::new(1 in ut_mutex_new_01() [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/util/ |
H A D | dispatcher.rs | 100 Self::Http1(Http1Dispatcher::new(io)) 123 pub(crate) fn new(io: S) -> Self { 125 inner: Arc::new(Inner { 126 io: UnsafeCell::new(io), 127 occupied: AtomicBool::new(false), 128 shutdown: AtomicBool::new(false), 257 // The connection close flag organizes new stream commits to the current connection when 298 Self::Http2(Http2Dispatcher::new(config, io)) 306 pub(crate) fn new(config: H2Config, io: S) -> Self { 309 let mut flow = FlowControl::new(DEFAULT_WINDOW_SIZ [all...] |
H A D | request.rs | 26 pub(crate) fn new(request: Request) -> Self { 28 request: UnsafeCell::new(request), 40 pub(crate) fn new(request: Request) -> Self { 42 cell: Arc::new(ReqCell::new(request)),
|
/commonlibrary/rust/ylong_http/ylong_http/src/h2/hpack/representation/ |
H A D | encoder.rs | 33 /// Creates a new, empty `ReprEncoder`. 34 pub(crate) fn new(table: &'a mut DynamicTable) -> Self { 58 /// new piece of memory, and the subsequent decoding part will be written 59 /// into the new memory. 90 let searcher = TableSearcher::new(self.table); 92 Some(TableIndex::Header(index)) => Indexed::new(index).encode(&mut dst[cur..]), 96 Indexing::new(index, v.into_bytes(), use_huffman).encode(&mut dst[cur..]) 101 IndexingWithName::new( 132 /// Creates a new, empty `ReprEncStateHolder`. 133 pub(crate) fn new() 171 fn new(parts: Parts) -> Self { new() functions 248 fn new(index: usize) -> Self { new() functions 265 fn new(index: usize, value: Vec<u8>, is_huffman: bool) -> Self { new() functions 288 fn new(name: Vec<u8>, value: Vec<u8>, is_huffman: bool) -> Self { new() functions 311 fn new(index: usize, value: Vec<u8>, is_huffman: bool) -> Self { new() functions 334 fn new(name: Vec<u8>, value: Vec<u8>, is_huffman: bool) -> Self { new() functions 357 fn new(index: usize, value: Vec<u8>, is_huffman: bool) -> Self { new() functions 380 fn new(name: Vec<u8>, value: Vec<u8>, is_huffman: bool) -> Self { new() functions 420 fn new() -> Self { new() functions 458 fn new() -> Self { new() functions 531 fn new(src: Vec<u8>, is_huffman: bool) -> Self { new() functions [all...] |
/commonlibrary/rust/ylong_json/src/ |
H A D | value.rs | 166 /// // assert_eq!(value, JsonValue::String(CString::new("Hello World"))); in fmt() 171 let result = Self::String(JsonString::new(str).unwrap()); in fmt() 185 /// let value = JsonValue::new_array(Array::new()); in fmt() 186 /// assert_eq!(value, JsonValue::Array(Array::new())); in fmt() 198 /// let value = JsonValue::new_object(Object::new()); in fmt() 199 /// assert_eq!(value, JsonValue::Object(Object::new())); in fmt() 313 /// let array_value = JsonValue::new_array(Array::new()); in fmt() 329 /// let object_value = JsonValue::new_object(Object::new()); in fmt() 387 /// assert_eq!(string_value.try_as_string().unwrap(), &CString::new("Hello World").unwrap()); in fmt() 391 /// //assert_eq!(string_value.try_as_string().unwrap(), &CString::new("Hell in fmt() [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/benches/ |
H A D | ylong_tokio_rwlock.rs | 52 let lock = Arc::new(RwLock::new(())); in tokio_rwlock_read() 77 let lock = Arc::new(YlongRwlock::new(())); in ylong_rwlock_read() 101 let lock = Arc::new(RwLock::new(())); in tokio_rwlock_write() 126 let lock = Arc::new(YlongRwlock::new(())); in ylong_rwlock_write() 151 let lock = Arc::new(RwLock::new(())); in tokio_rwlock_write_read() [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/dns/ |
H A D | happy_eyeballs.rs | 60 pub(crate) fn new(addrs: Vec<SocketAddr>) -> Self { 94 pub(crate) fn new(addrs: RemoteAddrs, delay: Sleep) -> Self { 100 pub(crate) fn new(timeout: Option<Duration>, delay: Option<Duration>) -> Self { 106 fn new(addrs: Vec<SocketAddr>, timeout: Option<Duration>) -> Self { in new() functions 108 addrs: DomainAddrs::new(addrs), in new() 126 None => Err(Error::new(ErrorKind::NotConnected, "Invalid domain")), 133 pub(crate) fn new(socket_addr: Vec<SocketAddr>, config: EyeBallConfig) -> Self { 134 let socket_addr = ResolvedAddrs::new(socket_addr.into_iter()); 141 preferred_addr: RemoteAddrs::new( 156 preferred_addr: RemoteAddrs::new( [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/conn/ |
H A D | http2.rs | 56 let data = BodyDataRef::new(message.request.clone()); 117 let text_io = TextIo::new(conn); in frame_2_response() 120 let length = match BodyLengthParser::new(message.request.ref_mut().method(), &part).parse() { in frame_2_response() 126 let body = HttpBody::new(message.interceptor, length, Box::new(text_io), &[0u8; 0])?; in frame_2_response() 128 Ok(Response::new( in frame_2_response() 139 let mut header_part = h2::Parts::new(); 142 let headers_payload = h2::Headers::new(header_part); 144 let mut flag = FrameFlags::new(UNUSED_FLAG); 233 pub(crate) fn new(handl [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/executor/ |
H A D | blocking_pool.rs | 44 pub fn new(builder: &CommonBuilder) -> BlockPoolSpawner { in new() functions 52 inner: Arc::new(Inner { in new() 53 shared: Mutex::new(Shared { in new() 54 queue: VecDeque::new(), in new() 61 worker_threads: VecDeque::new(), in new() 63 condvar: Condvar::new(), in new() 64 shutdown_shared: Mutex::new(false), in new() 65 shutdown_condvar: Condvar::new(), in new() 175 let mut builder = thread::Builder::new().name(format!("block-r-{worker_id}")); in create_permanent_threads() 187 return Err(ScheduleError::new(ErrorKin in create_permanent_threads() [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/sync/mpsc/unbounded/ |
H A D | queue.rs | 45 fn new() -> Block<T> { in new() functions 48 next: AtomicPtr::new(ptr::null_mut()), in new() 109 pub(crate) fn new() -> Queue<T> { 110 let block = Box::new(Block::new()); 113 head: RefCell::new(Head { 115 block: NonNull::new(block_ptr).unwrap(), 119 block: AtomicPtr::new(block_ptr), 120 index: AtomicUsize::new(0), 122 rx_waker: AtomicWaker::new(), [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/io/ |
H A D | async_buf_read.rs | 53 Pin::new(&mut **self.get_mut()).poll_fill_buf(cx) in poll_fill_buf() 57 Pin::new(&mut **self).consume(amt) in poll_fill_buf() 64 Pin::new(&mut **self.get_mut()).poll_fill_buf(cx) in poll_fill_buf() 68 Pin::new(&mut **self).consume(amt) in poll_fill_buf() 103 /// let mut buf_reader = AsyncBufReader::new(file); 110 ReadUtilTask::new(self, byte, buf) in read_until() 121 /// let mut res = String::new(); 122 /// let mut buf_reader = AsyncBufReader::new(file); 129 ReadLineTask::new(self, buf) in read_line() 138 /// let mut buf_reader = AsyncBufReader::new(fil [all...] |