pub struct FastInput {
ptr: *const u8,
}Fields§
§ptr: *const u8Implementations§
Source§impl FastInput
impl FastInput
pub unsafe fn stdin() -> Self
Sourcepub unsafe fn from_slice(s: &[u8]) -> Self
pub unsafe fn from_slice(s: &[u8]) -> Self
Examples found in repository?
crates/library_checker/src/sample/many_aplusb.rs (line 19)
16pub fn many_aplusb_fast(reader: impl Read, writer: impl Write) {
17 let s = read_all_unchecked(reader);
18 let mut writer = FastOutput::with_capacity(1 << 12, writer);
19 let mut scanner = unsafe { FastInput::from_slice(s.as_bytes()) };
20 let t = unsafe { scanner.u64() };
21 for _ in 0..t {
22 let a = unsafe { scanner.u64() };
23 let b = unsafe { scanner.u64() };
24 writer.u64(a + b);
25 writer.byte(b'\n');
26 }
27}Sourcepub unsafe fn u64(&mut self) -> u64
pub unsafe fn u64(&mut self) -> u64
Examples found in repository?
crates/competitive/src/tools/fastio.rs (line 269)
268 pub unsafe fn usize(&mut self) -> usize {
269 unsafe { self.u64() as usize }
270 }
271
272 pub unsafe fn i8(&mut self) -> i8 {
273 unsafe {
274 let b = *self.ptr == b'-';
275 self.ptr = self.ptr.add(b as usize);
276 let mut x = self.u8() as i8;
277 if b {
278 x = x.wrapping_neg();
279 }
280 x
281 }
282 }
283
284 pub unsafe fn i16(&mut self) -> i16 {
285 unsafe {
286 let b = *self.ptr == b'-';
287 self.ptr = self.ptr.add(b as usize);
288 let mut x = self.u16() as i16;
289 if b {
290 x = x.wrapping_neg();
291 }
292 x
293 }
294 }
295
296 pub unsafe fn i32(&mut self) -> i32 {
297 unsafe {
298 let b = *self.ptr == b'-';
299 self.ptr = self.ptr.add(b as usize);
300 let mut x = self.u32() as i32;
301 if b {
302 x = x.wrapping_neg();
303 }
304 x
305 }
306 }
307
308 pub unsafe fn i64(&mut self) -> i64 {
309 unsafe {
310 let b = *self.ptr == b'-';
311 self.ptr = self.ptr.add(b as usize);
312 let mut x = self.u64() as i64;
313 if b {
314 x = x.wrapping_neg();
315 }
316 x
317 }
318 }More examples
crates/library_checker/src/sample/many_aplusb.rs (line 20)
16pub fn many_aplusb_fast(reader: impl Read, writer: impl Write) {
17 let s = read_all_unchecked(reader);
18 let mut writer = FastOutput::with_capacity(1 << 12, writer);
19 let mut scanner = unsafe { FastInput::from_slice(s.as_bytes()) };
20 let t = unsafe { scanner.u64() };
21 for _ in 0..t {
22 let a = unsafe { scanner.u64() };
23 let b = unsafe { scanner.u64() };
24 writer.u64(a + b);
25 writer.byte(b'\n');
26 }
27}pub unsafe fn usize(&mut self) -> usize
pub unsafe fn i8(&mut self) -> i8
pub unsafe fn i16(&mut self) -> i16
pub unsafe fn i32(&mut self) -> i32
pub unsafe fn i128(&mut self) -> i128
pub unsafe fn isize(&mut self) -> isize
pub unsafe fn byte(&mut self) -> u8
pub unsafe fn parse<T>(&mut self) -> Twhere
T: FromStr,
Auto Trait Implementations§
impl Freeze for FastInput
impl RefUnwindSafe for FastInput
impl !Send for FastInput
impl !Sync for FastInput
impl Unpin for FastInput
impl UnsafeUnpin for FastInput
impl UnwindSafe for FastInput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more