Dataset Viewer
Auto-converted to Parquet Duplicate
content
stringlengths
3
6.31k
id
int64
0
123
{ let request: Request = request.into_client_request()?; let domain = domain(&request)?; let port = port(&request)?; let try_socket = TcpStream::connect((domain.as_str(), port)).await; let socket = try_socket.map_err(Error::Io)?; client_async_tls_with_connector_and_config(request, socket, connector, config).await }
0
{ unsafe { atomic_load ( self . as_ptr ( ) ) } }
1
{ accept_hdr_async(stream, NoCallback).await }
2
{ connect_async_with_tls_connector_and_config(request, connector, None).await }
3
{ let mut foot_children = layout.children(); let foot_background = Primitive::Quad { bounds: layout.bounds(), background: style.foot_background, border_radius: style.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, }; let (foot, foot_mouse_interaction) = foot.as_ref().map_or_else( || (Primitive::None, mouse::Interaction::default()), |foot| { foot.draw( renderer, &Defaults { text: defaults::Text { color: style.foot_text_color, }, }, foot_children .next() .expect("Graphics: Layout should have a foot content layout"), cursor_position, viewport, ) }, ); ( Primitive::Group { primitives: vec![foot_background, foot], }, foot_mouse_interaction, ) }
4
{ let db = checked_memory_handle ( ) ? ; db . execute ( " INSERT INTO foo ( i ) VALUES ( ? 1 ) " [ Value : : Integer ( 10 ) ] ) ? ; assert_eq ! ( 10i64 db . one_column : : < i64 > ( " SELECT i FROM foo " ) ? ) ; Ok ( ( ) ) }
5
{ match File::open(&path) { Err(_) => { println!("cannot open file: {:?}", path.as_ref()); exit(1) } Ok(file) => file, } }
6
{ assert_eq!(PageSnapshot_Metadata::VERSION, snapshot.version); let mut snapshot_proxy = PageSnapshot_new_Proxy(snapshot.inner); // TODO get a reference when too big snapshot_proxy.get(key).with(move |raw_res| { let state = match raw_res.map(|res| ledger::value_result(res)) { // the .ok() has the behavior of acting like invalid state is empty // and thus deleting invalid state and overwriting it with good state Ok(Ok(Some(buf))) => Ok(buf_to_state(&buf).ok()), Ok(Ok(None)) => { info!("No state in conflicting page"); Ok(None) } Err(err) => { warn!("FIDL failed on initial response: {:?}", err); Err(()) } Ok(Err(err)) => { warn!("Ledger failed to retrieve key: {:?}", err); Err(()) } }; done(state); }); }
7
{ client_async_with_config(request, stream, None).await }
8
{ assert!(-32 <= val && val < 0); write_fixval(wr, Marker::FixNeg(val)) }
9
{ let a = unsafe { & * ( self . as_ptr ( ) as * const AtomicBool ) } ; a . fetch_or ( val Ordering : : AcqRel ) }
10
{ let boxes = iproduct!(0..9, 0..9); boxes }
11
{ try!(write_marker(wr, Marker::U16)); write_data_u16(wr, val) }
12
{ match val { val if -32 <= val && val < 0 => { let marker = Marker::FixNeg(val as i8); try!(write_fixval(wr, marker)); Ok(marker) } val if -128 <= val && val < -32 => { write_i8(wr, val as i8).and(Ok(Marker::I8)) } val if -32768 <= val && val < -128 => { write_i16(wr, val as i16).and(Ok(Marker::I16)) } val if -2147483648 <= val && val < -32768 => { write_i32(wr, val as i32).and(Ok(Marker::I32)) } val if val < -2147483648 => { write_i64(wr, val).and(Ok(Marker::I64)) } val if 0 <= val && val < 128 => { let marker = Marker::FixPos(val as u8); try!(write_fixval(wr, marker)); Ok(marker) } val if val < 256 => { write_u8(wr, val as u8).and(Ok(Marker::U8)) } val if val < 65536 => { write_u16(wr, val as u16).and(Ok(Marker::U16)) } val if val < 4294967296 => { write_u32(wr, val as u32).and(Ok(Marker::U32)) } val => { write_i64(wr, val).and(Ok(Marker::I64)) } } }
13
{ let db = Connection : : open_in_memory ( ) ? ; db . execute_batch ( " CREATE TABLE foo ( b BLOB t TEXT i INTEGER f FLOAT n ) " ) ? ; Ok ( db ) }
14
{ pub fn load ( & self ) - > T { unsafe { atomic_load ( self . as_ptr ( ) ) } } }
15
{ let mut result = Vec::new(); for crates_diff in db_data.merge_join_by(index_data, |db, index| db.name.cmp(&index.name)) { match crates_diff { Both(db_crate, index_crate) => { for release_diff in db_crate .releases .iter() .merge_join_by(index_crate.releases.iter(), |db_release, index_release| { db_release.version.cmp(&index_release.version) }) { match release_diff { Both(db_release, index_release) => { let index_yanked = index_release.yanked.expect("index always has yanked-state"); // if `db_release.yanked` is `None`, the record // is coming from the build queue, not the `releases` // table. // In this case, we skip this check. if let Some(db_yanked) = db_release.yanked { if db_yanked != index_yanked { result.push(Difference::ReleaseYank( db_crate.name.clone(), db_release.version.clone(), index_yanked, )); } } } Left(db_release) => result.push(Difference::ReleaseNotInIndex( db_crate.name.clone(), db_release.version.clone(), )), Right(index_release) => result.push(Difference::ReleaseNotInDb( index_crate.name.clone(), index_release.version.clone(), )), } } } Left(db_crate) => result.push(Difference::CrateNotInIndex(db_crate.name.clone())), Right(index_crate) => result.push(Difference::CrateNotInDb( index_crate.name.clone(), index_crate .releases .iter() .map(|r| r.version.clone()) .collect(), )), }; } result }
16
{ fn is_invalid_column_type ( err : Error ) - > bool { matches ! ( err Error : : InvalidColumnType ( . . ) ) } let db = checked_memory_handle ( ) ? ; db . execute ( " INSERT INTO foo ( b t i f ) VALUES ( X ' 0102 ' ' text ' 1 1 . 5 ) " [ ] ) ? ; let mut stmt = db . prepare ( " SELECT b t i f n FROM foo " ) ? ; let mut rows = stmt . query ( [ ] ) ? ; let row = rows . next ( ) ? . unwrap ( ) ; assert_eq ! ( vec ! [ 1 2 ] row . get : : < _ Vec < u8 > > ( 0 ) ? ) ; assert_eq ! ( " text " row . get : : < _ String > ( 1 ) ? ) ; assert_eq ! ( 1 row . get : : < _ c_int > ( 2 ) ? ) ; assert ! ( ( 1 . 5 - row . get : : < _ c_double > ( 3 ) ? ) . abs ( ) < f64 : : EPSILON ) ; assert_eq ! ( row . get : : < _ Option < c_int > > ( 4 ) ? None ) ; assert_eq ! ( row . get : : < _ Option < c_double > > ( 4 ) ? None ) ; assert_eq ! ( row . get : : < _ Option < String > > ( 4 ) ? None ) ; assert ! ( is_invalid_column_type ( row . get : : < _ c_int > ( 0 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ c_int > ( 0 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ i64 > ( 0 ) . err ( ) . unwrap ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ c_double > ( 0 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ String > ( 0 ) . unwrap_err ( ) ) ) ; # [ cfg ( feature = " time " ) ] assert ! ( is_invalid_column_type ( row . get : : < _ time : : OffsetDateTime > ( 0 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ Option < c_int > > ( 0 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ c_int > ( 1 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ i64 > ( 1 ) . err ( ) . unwrap ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ c_double > ( 1 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ Vec < u8 > > ( 1 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ Option < c_int > > ( 1 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ String > ( 2 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ Vec < u8 > > ( 2 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ Option < String > > ( 2 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ c_int > ( 3 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ i64 > ( 3 ) . err ( ) . unwrap ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ String > ( 3 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ Vec < u8 > > ( 3 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ Option < c_int > > ( 3 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ c_int > ( 4 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ i64 > ( 4 ) . err ( ) . unwrap ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ c_double > ( 4 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ String > ( 4 ) . unwrap_err ( ) ) ) ; assert ! ( is_invalid_column_type ( row . get : : < _ Vec < u8 > > ( 4 ) . unwrap_err ( ) ) ) ; # [ cfg ( feature = " time " ) ] assert ! ( is_invalid_column_type ( row . get : : < _ time : : OffsetDateTime > ( 4 ) . unwrap_err ( ) ) ) ; Ok ( ( ) ) }
17
{ let metadata = if request.follow_symlink { std::fs::metadata(&request.path) } else { std::fs::symlink_metadata(&request.path) }.map_err(Error::Metadata)?; let symlink = if metadata.file_type().is_symlink() { ack! { std::fs::read_link(&request.path), warn: "failed to read symlink for '{}'", request.path.display() } } else { None }; let ext_attrs = if request.collect_ext_attrs { ext_attrs(&request) } else { vec!() }; #[cfg(target_os = "linux")] let flags_linux = if !metadata.file_type().is_symlink() { ack! { ospect::fs::linux::flags(&request.path), warn: "failed to collect flags for '{}'", request.path.display() } } else { // Flags are available only for non-symlinks. For symlinks, the function // would return flags mask for the target file, which can look confusing // in the results. None }; let response = Response { path: request.path, metadata: metadata, symlink: symlink, ext_attrs: ext_attrs, #[cfg(target_os = "linux")] flags_linux: flags_linux, }; session.reply(response)?; Ok(()) }
18
{ crate::client_async_with_config(request, TokioAdapter(stream), config).await }
19
{ # [ inline ] fn from ( val : T ) - > AtomicCell < T > { AtomicCell : : new ( val ) } } impl < T : Copy + fmt : : Debug > fmt : : Debug for AtomicCell < T > { fn fmt ( & self f : & mut fmt : : Formatter < ' _ > ) - > fmt : : Result { f . debug_struct ( " AtomicCell " ) . field ( " value " & self . load ( ) ) . finish ( ) } } const fn can_transmute < A B > ( ) - > bool { ( mem : : size_of : : < A > ( ) = = mem : : size_of : : < B > ( ) ) & ( mem : : align_of : : < A > ( ) > = mem : : align_of : : < B > ( ) ) }
20
{ let a = unsafe { & * ( self . as_ptr ( ) as * const AtomicBool ) } ; a . fetch_xor ( val Ordering : : AcqRel ) }
21
{ if len < 16 { let marker = Marker::FixArray(len as u8); try!(write_fixval(wr, marker)); Ok(marker) } else if len < 65536 { try!(write_marker(wr, Marker::Array16)); write_data_u16(wr, len as u16).and(Ok(Marker::Array16)) } else { try!(write_marker(wr, Marker::Array32)); write_data_u32(wr, len).and(Ok(Marker::Array32)) } }
22
{ let mut in_data = dot_vox::load(ifpath).unwrap(); let collada: collada_io::collada::Collada; let mut geometries: Vec<collada_io::geometry::Geometry> = Vec::new(); for model in &mut in_data.models { let size = model.size; let voxels = reorder_voxels(&mut model.voxels, &size); let mvoxels = convert_meta_voxels(&voxels, &size); let triangles = convert_triangles(&mvoxels); let mut vertices: Vec<Vertex> = Vec::new(); let mut normals: Vec<Normal> = Vec::new(); let mut indexed_triangles: Vec<IndexedTriangle> = Vec::new(); index_triangles(&triangles, &mut vertices, &mut normals, &mut indexed_triangles); let mut primitive: Vec<usize> = Vec::new(); primitive.reserve(indexed_triangles.len() * 3); let mut mesh_positions: Vec<f32> = Vec::new(); mesh_positions.reserve(vertices.len() * 3); // TODO: Add normals for idx_triangle in indexed_triangles { primitive.push(idx_triangle.a); primitive.push(idx_triangle.b); primitive.push(idx_triangle.c); } for vertex in vertices { mesh_positions.push(vertex.x); mesh_positions.push(vertex.y); mesh_positions.push(vertex.z); } geometries.push(collada_io::geometry::Geometry { id: Some("Voxel-mesh".to_string()), name: Some("Voxel".to_string()), mesh: collada_io::geometry::Mesh { triangles: collada_io::geometry::Triangles { vertices: "#Cube-mesh-vertices".to_string(), normals: None, tex_vertices: None, primitive: Some(primitive), material: None }, vertices: collada_io::geometry::Vertices { id: "Voxel-mesh-vertices".to_string(), name: None, source: "#Voxel-mesh-positions".to_string() }, sources: vec! { collada_io::geometry::Source { id: "Voxel-mesh-positions".to_string(), float_array: collada_io::geometry::FloatArray { id: "Voxel-mesh-positions-array".to_string(), data: mesh_positions }, accessor: collada_io::geometry::Accessor { params: vec! { "X".to_string(), "Y".to_string(), "Z".to_string() } } }, } } }); } let mut file = File::create(ofpath).unwrap(); collada = collada_io::collada::Collada { scene: Some(collada_io::scene::Scene { visual_scenes: vec!{ "#Scene".to_string() } }), visual_scenes: Some(vec!{ collada_io::scene::VisualScene { id: "Scene".to_string(), name: "Scene".to_string(), nodes: vec!{ collada_io::scene::Node { id: "Voxel".to_string(), name: "Voxel".to_string(), transformation_elements: vec!{ collada_io::scene::TransformationElement::Matrix { sid: "transform".to_string(), matrix: vec! { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, } } }, instances: vec!{ collada_io::scene::Instance::Geometry { url: "#Voxel-mesh".to_string(), name: Some("Voxel".to_string()), sid: None, bind_material: None } } } } } }), asset: collada_io::meta::Asset::default(), geometries: Some(geometries) }; collada.write_to(&mut file).unwrap(); }
23
{ let mut prev = self . load ( ) ; while let Some ( next ) = f ( prev ) { match self . compare_exchange ( prev next ) { x Ok ( _ ) = > return x Err ( next_prev ) = > prev = next_prev } } Err ( prev ) }
24
{ match val { true => write_fixval(wr, Marker::True), false => write_fixval(wr, Marker::False) } }
25
{ Sampling::<(MCLK, SrInvalid)> { data: 0b1000 << 9, t: PhantomData::<(MCLK, SrInvalid)>, } }
26
{ let decompressed = dec(expected_comp).expect("Valid Decompress"); assert_eq!(decompressed, expected_dec); }
27
{ crate::accept_hdr_async_with_config(TokioAdapter(stream), callback, config).await }
28
{ let from = from . as_ref ( ) . to_owned ( ) ; let to = to . as_ref ( ) . to_owned ( ) ; asyncify ( move | | std : : fs : : rename ( from to ) ) . await }
29
{ let mut head_children = layout.children(); let head_background = Primitive::Quad { bounds: layout.bounds(), background: style.head_background, border_radius: style.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, }; let (head, head_mouse_interaction) = head.draw( renderer, &Defaults { text: defaults::Text { color: style.head_text_color, }, }, head_children .next() .expect("Graphics: Layout should have a head content layout"), cursor_position, viewport, ); let (close, close_mouse_interaction) = head_children.next().map_or( (Primitive::None, mouse::Interaction::default()), |close_layout| { let close_bounds = close_layout.bounds(); let is_mouse_over_close = close_bounds.contains(cursor_position); ( Primitive::Text { content: super::icons::Icon::X.into(), font: super::icons::ICON_FONT, size: close_layout.bounds().height + if is_mouse_over_close { 5.0 } else { 0.0 }, bounds: Rectangle { x: close_bounds.center_x(), y: close_bounds.center_y(), ..close_bounds }, color: style.close_color, horizontal_alignment: HorizontalAlignment::Center, vertical_alignment: VerticalAlignment::Center, }, if is_mouse_over_close { mouse::Interaction::Pointer } else { mouse::Interaction::default() }, ) }, ); ( Primitive::Group { primitives: vec![head_background, head, close], }, head_mouse_interaction.max(close_mouse_interaction), ) }
30
{ wr.write_u8(marker.to_u8()).map_err(From::from) }
31
{ try!(write_marker(wr, Marker::F64)); write_data_f64(wr, val) }
32
{ atomic ! { T a { a = & * ( dst as * const _ as * const _ ) ; let res = mem : : transmute_copy ( & a . swap ( mem : : transmute_copy ( & val ) Ordering : : AcqRel ) ) ; mem : : forget ( val ) ; res } { let _guard = lock ( dst as usize ) . write ( ) ; ptr : : replace ( dst val ) } } }
33
{ match self . compare_exchange ( current new ) { Ok ( v ) = > v Err ( v ) = > v } }
34
{ }
35
{ matches ! ( err Error : : InvalidColumnType ( . . ) ) }
36
{ try!(write_marker(wr, Marker::I32)); write_data_i32(wr, val) }
37
{ eprintln!("Check if it compresses and decompresses \"Hello world!\""); let compressed = compress(&"Hello world!".encode_utf16().collect::<Vec<u16>>()); assert_ne!(compressed, "Hello world!"); let decompressed = decompress(compressed).expect("Valid Decompress"); assert_eq!(decompressed, "Hello world!"); /* it('compresses and decompresses null', function() { var compressed = compress(null); if (uint8array_mode===false){ expect(compressed).toBe(''); expect(typeof compressed).toBe(typeof ''); } else { //uint8array expect(compressed instanceof Uint8Array).toBe(true); expect(compressed.length).toBe(0); //empty array } var decompressed = decompress(compressed); expect(decompressed).toBe(null); }); */ /* it('compresses and decompresses undefined', function() { var compressed = compress(); if (uint8array_mode===false){ expect(compressed).toBe(''); expect(typeof compressed).toBe(typeof ''); } else { //uint8array expect(compressed instanceof Uint8Array).toBe(true); expect(compressed.length).toBe(0); //empty array } var decompressed = decompress(compressed); expect(decompressed).toBe(null); }); */ /* it('decompresses null', function() { var decompressed = decompress(null); expect(decompressed).toBe(''); }); */ eprintln!("Check if it compresses and decompresses an empty string"); let compressed = compress(&"".encode_utf16().collect::<Vec<u16>>()); if !bytearray { assert_ne!(compressed, ""); // expect(typeof compressed).toBe(typeof ''); } else { // expect(compressed instanceof Uint8Array).toBe(true); assert!(!compressed.is_empty()); } let decompressed = decompress(compressed).expect("Valid Decompress"); assert_eq!(decompressed, ""); eprintln!("Check if it compresses and decompresses all printable UTF-16 characters"); let mut test_string = String::new(); for i in 32..127 { test_string.push(std::char::from_u32(i).expect("Valid Char")); } for i in (128 + 32)..55296 { test_string.push(std::char::from_u32(i).expect("Valid Char")); } for i in 63744..65536 { test_string.push(std::char::from_u32(i).expect("Valid Char")); } let compressed = compress(&test_string.encode_utf16().collect::<Vec<u16>>()); assert_ne!(compressed, test_string.as_str()); let decompressed = decompress(compressed).expect("Valid Decompress"); assert_eq!(decompressed, test_string.as_str()); eprintln!("Check if it compresses and decompresses a string that repeats"); let test_string = "aaaaabaaaaacaaaaadaaaaaeaaaaa"; let compressed = compress(&test_string.encode_utf16().collect::<Vec<u16>>()); assert_ne!(compressed, test_string); assert!(compressed.len() < test_string.len()); let decompressed = decompress(compressed).expect("Valid Decompress"); assert_eq!(decompressed, test_string); eprintln!("Check if it compresses and decompresses a long string"); let mut test_string = String::new(); for _ in 0..1000 { write!(&mut test_string, "{} ", rand::thread_rng().gen::<f64>()) .expect("write rand float to string") } let compressed = compress(&test_string.encode_utf16().collect::<Vec<u16>>()); assert_ne!(compressed, test_string.as_str()); assert!(compressed.len() < test_string.len()); let decompressed = decompress(compressed).expect("Valid Decompress"); assert_eq!(decompressed, test_string.as_str()); }
38
{ atomic ! { T a { a = & * ( dst as * const _ as * const _ ) ; let mut current_raw = mem : : transmute_copy ( & current ) ; let new_raw = mem : : transmute_copy ( & new ) ; loop { match a . compare_exchange_weak ( current_raw new_raw Ordering : : AcqRel Ordering : : Acquire ) { Ok ( _ ) = > break Ok ( current ) Err ( previous_raw ) = > { let previous = mem : : transmute_copy ( & previous_raw ) ; if ! T : : eq ( & previous & current ) { break Err ( previous ) ; } / / The compare - exchange operation has failed and didn ' t store new . The / / failure is either spurious or previous was semantically equal to / / current but not byte - equal . Let ' s retry with previous as the new / / current . current = previous ; current_raw = previous_raw ; } } } } { let guard = lock ( dst as usize ) . write ( ) ; if T : : eq ( & * dst & current ) { Ok ( ptr : : replace ( dst new ) ) } else { let val = ptr : : read ( dst ) ; / / The value hasn ' t been changed . Drop the guard without incrementing the stamp . guard . abort ( ) ; Err ( val ) } } } }
39
{ wr.write_u8(marker.to_u8()).map_err(|err| FixedValueWriteError(From::from(err))) }
40
{ try!(write_bin_len(wr, data.len() as u32)); wr.write_all(data).map_err(|err| ValueWriteError::InvalidDataWrite(WriteError(err))) }
41
{ let request: Request = request.into_client_request()?; let domain = domain(&request)?; let port = port(&request)?; let try_socket = TcpStream::connect((domain.as_str(), port)).await; let socket = try_socket.map_err(Error::Io)?; client_async_tls_with_connector_and_config(request, socket, None, config).await }
42
{ use std::io::prelude::*; let stdin = stdin(); let mut reader = BufReader::with_capacity(100 * 1024, stdin); let mut line = String::with_capacity(100); let mut matrix: Vec<Vec<T>> = Vec::new(); while reader.read_line(&mut line).unwrap() > 0 { matrix.push( line.trim() .split_whitespace() .map(|s| s.parse().unwrap()) .collect(), ); line.clear(); } return matrix; }
43
{ let db = checked_memory_handle ( ) ? ; let s = " hello world ! " ; db . execute ( " INSERT INTO foo ( t ) VALUES ( ? 1 ) " [ s . to_owned ( ) ] ) ? ; let from : String = db . one_column ( " SELECT t FROM foo " ) ? ; assert_eq ! ( from s ) ; Ok ( ( ) ) }
44
{ connect_async_with_config(request, None).await }
45
{ try!(write_str_len(wr, data.len() as u32)); wr.write_all(data.as_bytes()).map_err(|err| ValueWriteError::InvalidDataWrite(WriteError(err))) }
46
{ let mut ret_voxels: Vec<Option<dot_vox::Voxel>> = Vec::new(); let len: usize = (size.x as usize) * (size.y as usize) * (size.z as usize); ret_voxels.resize(len, None); for voxel in voxels { let idx = get_voxel_idx(voxel, size); ret_voxels[idx] = Some(*voxel); } return ret_voxels; }
47
{ self . execute ( fut ) }
48
{ accept_hdr_async_with_config(stream, callback, None).await }
49
{ let compressed = comp(expected_dec); assert_eq!(compressed, expected_comp); }
50
{ # [ allow ( non_snake_case ) ] let MASK : __m128i = _mm_set_epi64x ( 0x0001_0203_0405_0607 0x0809_0A0B_0C0D_0E0F ) ; let mut state_abcd = _mm_set_epi32 ( state [ 0 ] as i32 state [ 1 ] as i32 state [ 2 ] as i32 state [ 3 ] as i32 ) ; let mut state_e = _mm_set_epi32 ( state [ 4 ] as i32 0 0 0 ) ; for block in blocks { / / SAFETY : we use only unaligned loads with this pointer # [ allow ( clippy : : cast_ptr_alignment ) ] let block_ptr = block . as_ptr ( ) as * const __m128i ; let mut w0 = _mm_shuffle_epi8 ( _mm_loadu_si128 ( block_ptr . offset ( 0 ) ) MASK ) ; let mut w1 = _mm_shuffle_epi8 ( _mm_loadu_si128 ( block_ptr . offset ( 1 ) ) MASK ) ; let mut w2 = _mm_shuffle_epi8 ( _mm_loadu_si128 ( block_ptr . offset ( 2 ) ) MASK ) ; let mut w3 = _mm_shuffle_epi8 ( _mm_loadu_si128 ( block_ptr . offset ( 3 ) ) MASK ) ; # [ allow ( clippy : : needless_late_init ) ] let mut w4 ; let mut h0 = state_abcd ; let mut h1 = _mm_add_epi32 ( state_e w0 ) ; / / Rounds 0 . . 20 h1 = _mm_sha1rnds4_epu32 ( h0 h1 0 ) ; h0 = rounds4 ! ( h1 h0 w1 0 ) ; h1 = rounds4 ! ( h0 h1 w2 0 ) ; h0 = rounds4 ! ( h1 h0 w3 0 ) ; schedule_rounds4 ! ( h0 h1 w0 w1 w2 w3 w4 0 ) ; / / Rounds 20 . . 40 schedule_rounds4 ! ( h1 h0 w1 w2 w3 w4 w0 1 ) ; schedule_rounds4 ! ( h0 h1 w2 w3 w4 w0 w1 1 ) ; schedule_rounds4 ! ( h1 h0 w3 w4 w0 w1 w2 1 ) ; schedule_rounds4 ! ( h0 h1 w4 w0 w1 w2 w3 1 ) ; schedule_rounds4 ! ( h1 h0 w0 w1 w2 w3 w4 1 ) ; / / Rounds 40 . . 60 schedule_rounds4 ! ( h0 h1 w1 w2 w3 w4 w0 2 ) ; schedule_rounds4 ! ( h1 h0 w2 w3 w4 w0 w1 2 ) ; schedule_rounds4 ! ( h0 h1 w3 w4 w0 w1 w2 2 ) ; schedule_rounds4 ! ( h1 h0 w4 w0 w1 w2 w3 2 ) ; schedule_rounds4 ! ( h0 h1 w0 w1 w2 w3 w4 2 ) ; / / Rounds 60 . . 80 schedule_rounds4 ! ( h1 h0 w1 w2 w3 w4 w0 3 ) ; schedule_rounds4 ! ( h0 h1 w2 w3 w4 w0 w1 3 ) ; schedule_rounds4 ! ( h1 h0 w3 w4 w0 w1 w2 3 ) ; schedule_rounds4 ! ( h0 h1 w4 w0 w1 w2 w3 3 ) ; schedule_rounds4 ! ( h1 h0 w0 w1 w2 w3 w4 3 ) ; state_abcd = _mm_add_epi32 ( state_abcd h0 ) ; state_e = _mm_sha1nexte_epu32 ( h1 state_e ) ; } state [ 0 ] = _mm_extract_epi32 ( state_abcd 3 ) as u32 ; state [ 1 ] = _mm_extract_epi32 ( state_abcd 2 ) as u32 ; state [ 2 ] = _mm_extract_epi32 ( state_abcd 1 ) as u32 ; state [ 3 ] = _mm_extract_epi32 ( state_abcd 0 ) as u32 ; state [ 4 ] = _mm_extract_epi32 ( state_e 3 ) as u32 ; } cpufeatures : : new ! ( shani_cpuid " sha " " sse2 " " ssse3 " " sse4 . 1 " ) ; pub fn compress ( state : & mut [ u32 ; 5 ] blocks : & [ [ u8 ; 64 ] ] ) { / / TODO : Replace with https : / / github . com / rust - lang / rfcs / pull / 2725 / / after stabilization if shani_cpuid : : get ( ) { unsafe { digest_blocks ( state blocks ) ; } } else { super : : soft : : compress ( state blocks ) ; } }
51
{ let a = unsafe { & * ( self . as_ptr ( ) as * const AtomicBool ) } ; a . fetch_nand ( val Ordering : : AcqRel ) }
52
{ assert!(val < 128); write_fixval(wr, Marker::FixPos(val)) }
53
{ try!(write_marker(wr, Marker::I16)); write_data_i16(wr, val) }
54
{ Ok ( ( ) ) }
55
{ let mut buf = String::with_capacity(100); stdin().read_line(&mut buf).unwrap(); return buf.split_whitespace().map(|s| s.parse().unwrap()).collect(); }
56
{ let mut chars = i.chars(); if let Some(f) = chars.next() { if f.is_alphabetic() || f == '_' { let mut idx = 1; for c in chars { if !(c.is_alphanumeric() || c == '_') { break; } idx += 1; } let id = &i[..idx]; if is_reserved(id) { Err(nom::Err::Error(E::from_error_kind(i, ErrorKind::Satisfy))) } else { Ok((&i[idx..], Ident::from_str_unchecked(id))) } } else { Err(nom::Err::Error(E::from_error_kind(i, ErrorKind::Satisfy))) } } else { Err(nom::Err::Error(E::from_error_kind(i, ErrorKind::Eof))) } }
57
{ match File::create(&path) { Err(_) => { println!("cannot create file: {:?}", path.as_ref()); exit(1) } Ok(file) => file, } }
58
{ atomic ! { T a { a = & * ( dst as * const _ as * const _ ) ; a . store ( mem : : transmute_copy ( & val ) Ordering : : Release ) ; mem : : forget ( val ) ; } { let _guard = lock ( dst as usize ) . write ( ) ; ptr : : write ( dst val ) ; } } }
59
{ unsafe { atomic_compare_exchange_weak ( self . as_ptr ( ) current new ) } }
60
{ let aff_size = std::mem::size_of::<E::G1Affine>() + std::mem::size_of::<E::G2Affine>(); let exp_size = exp_size::<E>(); let proj_size = std::mem::size_of::<E::G1>() + std::mem::size_of::<E::G2>(); ((((mem as f64) * (1f64 - MEMORY_PADDING)) as usize) - (2 * core_count * ((1 << MAX_WINDOW_SIZE) + 1) * proj_size)) / (aff_size + exp_size) }
61
{ if mem : : needs_drop : : < T > ( ) { unsafe { self . as_ptr ( ) . drop_in_place ( ) ; } } }
62
{ let app = app::new_app(); let matches = app.get_matches(); let in_file = matches.value_of("input").unwrap_or(INPUT_FILEPATH); let out_file: &str; if matches.is_present("stl") { out_file = matches.value_of("output").unwrap_or(OUTPUT_STL_FILEPATH); convert_vox_stl(in_file, out_file); } else if matches.is_present("dae") { out_file = matches.value_of("output").unwrap_or(OUTPUT_DAE_FILEPATH); convert_vox_dae(in_file, out_file); } else { // Need either stl or dae so not sure what to do here } }
63
{ use std::convert::TryFrom; let vx: i16 = voxel.x.into(); let vy: i16 = voxel.y.into(); let vz: i16 = voxel.z.into(); let pos = dot_vox::Voxel { i: voxel.i, x: u8::try_from(vx + x)?, y: u8::try_from(vy + y)?, z: u8::try_from(vz + z)? }; let neighbor: Option<dot_vox::Voxel>; let idx = get_voxel_idx(&pos, size); neighbor = voxels[idx]; return Ok(neighbor.is_some()); }
64
{ fn inner<E, CS>(mut cs: CS, left: &Scalar<E>, right: &Scalar<E>) -> Result<Scalar<E>, Error> where E: IEngine, CS: ConstraintSystem<E>, { let scalar_type = zinc_types::ScalarType::expect_same(left.get_type(), right.get_type())?; scalar_type.assert_signed(false)?; let len = scalar_type.bitlength::<E>(); let left_bits = left .to_expression::<CS>() .into_bits_le_fixed(cs.namespace(|| "left bits"), len)?; let right_bits = right .to_expression::<CS>() .into_bits_le_fixed(cs.namespace(|| "left bits"), len)?; let result_bits = left_bits .into_iter() .zip(right_bits) .enumerate() .map(|(i, (l_bit, r_bit))| { Boolean::xor(cs.namespace(|| format!("bit {}", i)), &l_bit, &r_bit) }) .collect::<Result<Vec<Boolean>, SynthesisError>>()?; let result = AllocatedNum::pack_bits_to_element(cs.namespace(|| "result"), &result_bits)?; Ok(Scalar::new_unchecked_variable( result.get_value(), result.get_variable(), scalar_type, )) } auto_const!(inner, cs, left, right) }
65
{ for triangle in triangles { let normal_index: usize; let a_position: usize; let b_position: usize; let c_position: usize; match vertices.iter().position(|&x| x == triangle.a) { Some(idx) => { a_position = idx; }, None => { a_position = vertices.len(); vertices.push(triangle.a); } } match vertices.iter().position(|&x| x == triangle.b) { Some(idx) => { b_position = idx; }, None => { b_position = vertices.len(); vertices.push(triangle.b); } } match vertices.iter().position(|&x| x == triangle.c) { Some(idx) => { c_position = idx; }, None => { c_position = vertices.len(); vertices.push(triangle.c); } } match normals.iter().position(|&x| x == triangle.normal) { Some(idx) => { normal_index = idx; }, None => { normal_index = vertices.len(); normals.push(triangle.normal); } } idx_triangles.push(IndexedTriangle { normal: triangle.normal, normal_index, a: a_position, b: b_position, c: c_position }); } }
66
{ client_async_tls_with_connector_and_config(request, stream, None, config).await }
67
{ client_async_tls_with_connector_and_config(request, stream, None, None).await }
68
{ assert!(typeid >= 0); let marker = match len { 1 => { try!(write_marker(wr, Marker::FixExt1)); Marker::FixExt1 } 2 => { try!(write_marker(wr, Marker::FixExt2)); Marker::FixExt2 } 4 => { try!(write_marker(wr, Marker::FixExt4)); Marker::FixExt4 } 8 => { try!(write_marker(wr, Marker::FixExt8)); Marker::FixExt8 } 16 => { try!(write_marker(wr, Marker::FixExt16)); Marker::FixExt16 } len if len < 256 => { try!(write_marker(wr, Marker::Ext8)); try!(write_data_u8(wr, len as u8)); Marker::Ext8 } len if len < 65536 => { try!(write_marker(wr, Marker::Ext16)); try!(write_data_u16(wr, len as u16)); Marker::Ext16 } len => { try!(write_marker(wr, Marker::Ext32)); try!(write_data_u32(wr, len)); Marker::Ext32 } }; try!(write_data_i8(wr, typeid)); Ok(marker) }
69
{ let db = checked_memory_handle ( ) ? ; let v1234 = vec ! [ 1u8 2 3 4 ] ; db . execute ( " INSERT INTO foo ( b ) VALUES ( ? 1 ) " [ & v1234 ] ) ? ; let v : Vec < u8 > = db . one_column ( " SELECT b FROM foo " ) ? ; assert_eq ! ( v v1234 ) ; Ok ( ( ) ) }
70
{ atomic ! { T a { a = & * ( src as * const _ as * const _ ) ; mem : : transmute_copy ( & a . load ( Ordering : : Acquire ) ) } { let lock = lock ( src as usize ) ; / / Try doing an optimistic read first . if let Some ( stamp ) = lock . optimistic_read ( ) { / / We need a volatile read here because other threads might concurrently modify the / / value . In theory data races are * always * UB even if we use volatile reads and / / discard the data when a data race is detected . The proper solution would be to / / do atomic reads and atomic writes but we can ' t atomically read and write all / / kinds of data since AtomicU8 is not available on stable Rust yet . / / Load as MaybeUninit because we may load a value that is not valid as T . let val = ptr : : read_volatile ( src . cast : : < MaybeUninit < T > > ( ) ) ; if lock . validate_read ( stamp ) { return val . assume_init ( ) ; } } / / Grab a regular write lock so that writers don ' t starve this load . let guard = lock . write ( ) ; let val = ptr : : read ( src ) ; / / The value hasn ' t been changed . Drop the guard without incrementing the stamp . guard . abort ( ) ; val } } }
71
{ let mut mvoxels: Vec<Option<MetaVoxel>> = Vec::new(); let len: usize = (size.x as usize) * (size.y as usize) * (size.z as usize); mvoxels.resize(len, None); for (i, opt_voxel) in voxels.iter().enumerate() { match opt_voxel { Some(voxel) => { let mut faces: u8 = 0; let mut surrounded: bool = true; // Need to add check to see if there are empty spaces in order to add a face if voxel.x == 0 || !has_neighbor(voxels, voxel, size, -1, 0, 0).unwrap()// Left { faces |= 1 << 0; surrounded = false; } if voxel.y == 0 || !has_neighbor(voxels, voxel, size, 0, -1, 0).unwrap() // Back { faces |= 1 << 1; surrounded = false; } if voxel.z == 0 || !has_neighbor(voxels, voxel, size, 0, 0, -1).unwrap() // Bottom { faces |= 1 << 2; surrounded = false; } if ((voxel.x + 1) == (size.x as u8)) || !has_neighbor(voxels, voxel, size, 1, 0, 0).unwrap() // Right { faces |= 1 << 3; surrounded = false; } if (voxel.y + 1) == (size.y as u8) || !has_neighbor(voxels, voxel, size, 0, 1, 0).unwrap() // Front { faces |= 1 << 4; surrounded = false; } if ((voxel.z + 1) == (size.z as u8)) || !has_neighbor(voxels, voxel, size, 0, 0, 1).unwrap() // Top { faces |= 1 << 5; surrounded = false; } if !surrounded { mvoxels[i] = Some(MetaVoxel { voxel: *voxel, faces }); } } None => { } } } return mvoxels; }
72
{ if val < 128 { let marker = Marker::FixPos(val as u8); try!(write_fixval(wr, marker)); Ok(marker) } else if val < 256 { write_u8(wr, val as u8).and(Ok(Marker::U8)) } else if val < 65536 { write_u16(wr, val as u16).and(Ok(Marker::U16)) } else if val < 4294967296 { write_u32(wr, val as u32).and(Ok(Marker::U32)) } else { write_u64(wr, val).and(Ok(Marker::U64)) } }
73
{ if -32 <= val && val <= 0 { let marker = Marker::FixNeg(val as i8); try!(write_fixval(wr, marker)); Ok(marker) } else if -128 <= val && val < 128 { write_i8(wr, val as i8).and(Ok(Marker::I8)) } else if -32768 <= val && val < 32768 { write_i16(wr, val as i16).and(Ok(Marker::I16)) } else if -2147483648 <= val && val <= 2147483647 { write_i32(wr, val as i32).and(Ok(Marker::I32)) } else { write_i64(wr, val).and(Ok(Marker::I64)) } }
74
{ trace!("with_projects({:?})", search_terms); let luigi = try!(setup_luigi()); let projects = try!(luigi.search_projects_any(dir, search_terms)); if projects.is_empty() { return Err(format!("Nothing found for {:?}", search_terms).into()) } for project in &projects{ try!(f(project)); } Ok(()) }
75
{ let args: Vec<String> = std::env::args().collect(); if args.len() < 2 { eprintln!("Syntax: {} <filename>", args[0]); return; } let path = Path::new(&args[1]); let display = path.display(); let mut file = match File::open(&path) { Err(why) => panic!("Could not open file: {} (Reason: {})", display, why.description()), Ok(file) => file }; // read the full file into memory. panic on failure let mut raw_file = Vec::new(); file.read_to_end(&mut raw_file).unwrap(); // construct a cursor so we can seek in the raw buffer let mut cursor = Cursor::new(raw_file); let mut image = match decode_ppm_image(&mut cursor) { Ok (img) => img, Err(why) => panic!("Could not parse PPM file - Desc: {}", why.description()), }; show_image(&image); }
76
{ match val { &Value::Nil => try!(write_nil(wr)), &Value::Boolean(val) => try!(write_bool(wr, val)), // TODO: Replace with generic write_int(...). &Value::Integer(Integer::U64(val)) => { try!(write_uint(wr, val)); } &Value::Integer(Integer::I64(val)) => { try!(write_sint(wr, val)); } // TODO: Replace with generic write_float(...). &Value::Float(Float::F32(val)) => try!(write_f32(wr, val)), &Value::Float(Float::F64(val)) => try!(write_f64(wr, val)), &Value::String(ref val) => { try!(write_str(wr, &val)); } &Value::Binary(ref val) => { try!(write_bin(wr, &val)); } &Value::Array(ref val) => { try!(write_array_len(wr, val.len() as u32)); for item in val { try!(write_value(wr, item)); } } &Value::Map(ref val) => { try!(write_map_len(wr, val.len() as u32)); for &(ref key, ref val) in val { try!(write_value(wr, key)); try!(write_value(wr, val)); } } &Value::Ext(ty, ref data) => { try!(write_ext_meta(wr, data.len() as u32, ty)); try!(wr.write_all(data).map_err(|err| ValueWriteError::InvalidDataWrite(WriteError(err)))); } } Ok(()) }
77
{ if len < 256 { try!(write_marker(wr, Marker::Bin8)); write_data_u8(wr, len as u8).and(Ok(Marker::Bin8)) } else if len < 65536 { try!(write_marker(wr, Marker::Bin16)); write_data_u16(wr, len as u16).and(Ok(Marker::Bin16)) } else { try!(write_marker(wr, Marker::Bin32)); write_data_u32(wr, len).and(Ok(Marker::Bin32)) } }
78
{ let db = checked_memory_handle ( ) ? ; let s = " hello world ! " ; db . execute ( " INSERT INTO foo ( t ) VALUES ( ? 1 ) " [ & s ] ) ? ; let from : String = db . one_column ( " SELECT t FROM foo " ) ? ; assert_eq ! ( from s ) ; Ok ( ( ) ) }
79
{ let in_data = dot_vox::load(ifpath).unwrap(); let file = File::create(ofpath)?; let mut file = LineWriter::new(file); let len_str: String = in_data.palette.len().to_string() + "\n"; file.write_all(b"JASC\n")?; file.write_all(b"0100\n")?; file.write_all(len_str.as_bytes())?; for element in &in_data.palette { let color: Color = (*element).into(); let color_str: String = color.into(); file.write_all((color_str + "\n").as_bytes())?; } Ok(()) }
80
{ // width = 1+max(len(values[s]) for s in boxes) // let width = 2; let line = std::iter::repeat("-").take(9).collect::<String>(); let line = std::iter::repeat(line).take(3).collect::<Vec<String>>().join("+"); for r in 0..9 { let value_str = (0..9).map(|c| (r, c)) .map(|k| { let num = g[&k]; let mut num_str = num.map_or(" . ".to_string(), |num|{ format!("{:^3}", num) }); if k.1 == 2 || k.1 == 5 { num_str += "|"; } num_str }).collect::<String>(); println!("{}", value_str); if r == 2 || r == 5 { println!("{}", line); } } }
81
{ let serialized: Vec<u8> = SimpleSerializer::serialize(object).expect("Serialization should work"); let deserialized: T = SimpleDeserializer::deserialize(&serialized).expect("Deserialization should work"); assert_eq!(*object, deserialized); }
82
{ let mut body_children = layout.children(); let body_background = Primitive::Quad { bounds: layout.bounds(), background: style.body_background, border_radius: 0.0, border_width: 0.0, border_color: Color::TRANSPARENT, }; let (body, mouse_interaction) = body.draw( renderer, &Defaults { text: defaults::Text { color: style.body_text_color, }, }, body_children .next() .expect("Graphics: Layout should have a body content layout"), cursor_position, viewport, ); ( Primitive::Group { primitives: vec![body_background, body], }, mouse_interaction, ) }
83
{ try!(write_marker(wr, Marker::U8)); write_data_u8(wr, val) }
84
{ MessagePackSink(w) }
85
{ let mut triangles = Vec::new(); for opt_mvoxel in mvoxels { match opt_mvoxel { Some(mvoxel) => { let vleft_back_top = Vertex { x: mvoxel.voxel.x as f32 + 0.0, y: mvoxel.voxel.y as f32 + 0.0, z: mvoxel.voxel.z as f32 + 1.0, }; let vleft_front_top = Vertex { x: mvoxel.voxel.x as f32 + 0.0, y: mvoxel.voxel.y as f32 + 1.0, z: mvoxel.voxel.z as f32 + 1.0, }; let vleft_back_bottom = Vertex { x: mvoxel.voxel.x as f32 + 0.0, y: mvoxel.voxel.y as f32 + 0.0, z: mvoxel.voxel.z as f32 + 0.0, }; let vleft_front_bottom = Vertex { x: mvoxel.voxel.x as f32 + 0.0, y: mvoxel.voxel.y as f32 + 1.0, z: mvoxel.voxel.z as f32 + 0.0, }; let vright_back_top = Vertex { x: mvoxel.voxel.x as f32 + 1.0, y: mvoxel.voxel.y as f32 + 0.0, z: mvoxel.voxel.z as f32 + 1.0, }; let vright_front_top = Vertex { x: mvoxel.voxel.x as f32 + 1.0, y: mvoxel.voxel.y as f32 + 1.0, z: mvoxel.voxel.z as f32 + 1.0, }; let vright_back_bottom = Vertex { x: mvoxel.voxel.x as f32 + 1.0, y: mvoxel.voxel.y as f32 + 0.0, z: mvoxel.voxel.z as f32 + 0.0, }; let vright_front_bottom = Vertex { x: mvoxel.voxel.x as f32 + 1.0, y: mvoxel.voxel.y as f32 + 1.0, z: mvoxel.voxel.z as f32 + 0.0, }; if mvoxel.has_left() { let normal = Normal { x: 1.0, y: 0.0, z: 0.0 }; triangles.push(Triangle { normal, a: vleft_back_top, b: vleft_back_bottom, c: vleft_front_bottom }); triangles.push(Triangle { normal, a: vleft_back_top, b: vleft_front_top, c: vleft_front_bottom }); } if mvoxel.has_back() { let normal = Normal { x: 0.0, y: 1.0, z: 0.0 }; triangles.push(Triangle { normal, a: vleft_back_top, b: vright_back_top, c: vright_back_bottom }); triangles.push(Triangle { normal, a: vleft_back_top, b: vleft_back_bottom, c: vright_back_bottom }); } if mvoxel.has_bottom() { let normal = Normal { x: 0.0, y: 0.0, z: 1.0 }; triangles.push(Triangle { normal, a: vleft_back_bottom, b: vleft_front_bottom, c: vright_front_bottom }); triangles.push(Triangle { normal, a: vleft_back_bottom, b: vright_back_bottom, c: vright_front_bottom }); } if mvoxel.has_right() { let normal = Normal { x: -1.0, y: 0.0, z: 0.0 }; triangles.push(Triangle { normal, a: vright_back_top, b: vright_back_bottom, c: vright_front_bottom }); triangles.push(Triangle { normal, a: vright_back_top, b: vright_front_top, c: vright_front_bottom }); } if mvoxel.has_front() { let normal = Normal { x: 0.0, y: -1.0, z: 0.0 }; triangles.push(Triangle { normal, a: vleft_front_top, b: vright_front_top, c: vright_front_bottom }); triangles.push(Triangle { normal, a: vleft_front_top, b: vleft_front_bottom, c: vright_front_bottom }); } if mvoxel.has_top() { let normal = Normal { x: 0.0, y: 0.0, z: -1.0 }; triangles.push(Triangle { normal, a: vleft_back_top, b: vleft_front_top, c: vright_front_top }); triangles.push(Triangle { normal, a: vleft_back_top, b: vright_back_top, c: vright_front_top }); } }, None => { } } } return triangles; }
86
{ f . debug_struct ( " AtomicCell " ) . field ( " value " & self . load ( ) ) . finish ( ) }
87
{ try!(write_marker(wr, Marker::I8)); write_data_i8(wr, val) }
88
{ try!(write_marker(wr, Marker::U64)); write_data_u64(wr, val) }
89
{ let is_lock_free = can_transmute : : < T AtomicUnit > ( ) | can_transmute : : < T atomic : : AtomicU8 > ( ) | can_transmute : : < T atomic : : AtomicU16 > ( ) | can_transmute : : < T atomic : : AtomicU32 > ( ) ; # [ cfg ( not ( crossbeam_no_atomic_64 ) ) ] let is_lock_free = is_lock_free | can_transmute : : < T atomic : : AtomicU64 > ( ) ; is_lock_free }
90
{ client_async_tls_with_connector_and_config(request, stream, connector, None).await }
91
{ move |ratio| { if ratio_checker(ratio) { format!("{ratio:.3}") } else { format!("* {ratio:.3} *") } } }
92
{ let mut col = col; let mut writer = writer; let mut v = Vec::<u8>::with_capacity(((input.len() as f64) * 1.04) as usize); input.iter().for_each(|&b| { let encoded = encode_byte(b); v.push(encoded.0); col += match encoded.0 { ESCAPE => { v.push(encoded.1); 2 } DOT if col == 0 => { v.push(DOT); 2 } _ => 1, }; if col >= line_length { v.push(CR); v.push(LF); col = 0; } }); writer.write_all(&v)?; Ok(col) }
93
{ use x86_64::instructions::segmentation::set_cs; use x86_64::instructions::tables::load_tss; GDT.0.load(); unsafe { set_cs(GDT.1.codesel); load_tss(GDT.1.tsssel); } }
94
{ try!(write_marker(wr, Marker::F32)); write_data_f32(wr, val) }
95
{ let parsed_vidx = download_vidx_list(vidx_list, client, logger); let pdsc_list = parsed_vidx .filter_map(move |vidx| vidx.map(|v| flatmap_pdscs(v, client, logger))) .flatten(); download_stream(config, pdsc_list, client, logger, progress).collect() }
96
{ accept_hdr_async_with_config(stream, NoCallback, config).await }
97
{ try!(write_marker(wr, Marker::I64)); write_data_i64(wr, val) }
98
{ device_manager::register_driver(&s_pci_legacy_driver); device_manager::register_driver(&s_pci_native_driver); }
99
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
2