text
stringlengths
8
4.13M
use crate::prelude::*; use crate::{ Coordinate, Line, LineString, MultiLineString, MultiPolygon, Point, Polygon, Triangle, }; use num_traits::Float; use std::cmp::Ordering; use std::collections::BinaryHeap; use rstar::{RTree, RTreeNum}; /// Store triangle information // current is the candidate point for removal #[derive(Debug)] struct VScore<T, I> where T: Float, { left: usize, current: usize, right: usize, area: T, // `visvalingam_preserve` uses `intersector`, `visvalingam` does not intersector: I, } // These impls give us a min-heap impl<T, I> Ord for VScore<T, I> where T: Float, { fn cmp(&self, other: &VScore<T, I>) -> Ordering { other.area.partial_cmp(&self.area).unwrap() } } impl<T, I> PartialOrd for VScore<T, I> where T: Float, { fn partial_cmp(&self, other: &VScore<T, I>) -> Option<Ordering> { Some(self.cmp(other)) } } impl<T, I> Eq for VScore<T, I> where T: Float {} impl<T, I> PartialEq for VScore<T, I> where T: Float, { fn eq(&self, other: &VScore<T, I>) -> bool where T: Float, { self.area == other.area } } /// Geometries that can be simplified using the topology-preserving variant #[derive(Debug, Clone, Copy)] enum GeomType { Line, Ring, } /// Settings for Ring and Line geometries // initial min: if we ever have fewer than these, stop immediately // min_points: if we detect a self-intersection before point removal, and we only // have min_points left, stop: since a self-intersection causes removal of the spatially previous // point, THAT could lead to a further self-intersection without the possibility of removing // more points, potentially leaving the geometry in an invalid state. #[derive(Debug, Clone, Copy)] struct GeomSettings { initial_min: usize, min_points: usize, geomtype: GeomType, } /// Simplify a line using the [Visvalingam-Whyatt](http://www.tandfonline.com/doi/abs/10.1179/000870493786962263) algorithm // // This method returns the **indices** of the simplified line // epsilon is the minimum triangle area // The paper states that: // If [the new triangle's] calculated area is less than that of the last point to be // eliminated, use the latter's area instead. // (This ensures that the current point cannot be eliminated // without eliminating previously eliminated points) // (Visvalingam and Whyatt 2013, p47) // However, this does *not* apply if you're using a user-defined epsilon; // It's OK to remove triangles with areas below the epsilon, // then recalculate the new triangle area and push it onto the heap // based on Huon Wilson's original implementation: // https://github.com/huonw/isrustfastyet/blob/25e7a68ff26673a8556b170d3c9af52e1c818288/mem/line_simplify.rs fn visvalingam_indices<T>(orig: &LineString<T>, epsilon: &T) -> Vec<usize> where T: Float, { // No need to continue without at least three points if orig.0.len() < 3 { return orig.0.iter().enumerate().map(|(idx, _)| idx).collect(); } let max = orig.0.len(); // Adjacent retained points. Simulating the points in a // linked list with indices into `orig`. Big number (larger than or equal to // `max`) means no next element, and (0, 0) means deleted element. let mut adjacent: Vec<_> = (0..orig.0.len()) .map(|i| { if i == 0 { (-1_i32, 1_i32) } else { ((i - 1) as i32, (i + 1) as i32) } }) .collect(); // Store all the triangles in a minimum priority queue, based on their area. // // Invalid triangles are *not* removed if / when points are removed; they're // handled by skipping them as necessary in the main loop by checking the // corresponding entry in adjacent for (0, 0) values // Compute the initial triangles let mut pq = orig .triangles() .enumerate() .map(|(i, triangle)| VScore { area: triangle.area().abs(), current: i + 1, left: i, right: i + 2, intersector: (), }) .collect::<BinaryHeap<VScore<T, ()>>>(); // While there are still points for which the associated triangle // has an area below the epsilon while let Some(smallest) = pq.pop() { // This triangle's area is above epsilon, so skip it if smallest.area > *epsilon { continue; } // This triangle's area is below epsilon: eliminate the associated point let (left, right) = adjacent[smallest.current]; // A point in this triangle has been removed since this VScore // was created, so skip it if left as i32 != smallest.left as i32 || right as i32 != smallest.right as i32 { continue; } // We've got a valid triangle, and its area is smaller than epsilon, so // remove it from the simulated "linked list" let (ll, _) = adjacent[left as usize]; let (_, rr) = adjacent[right as usize]; adjacent[left as usize] = (ll, right); adjacent[right as usize] = (left, rr); adjacent[smallest.current as usize] = (0, 0); // Now recompute the adjacent triangle(s), using left and right adjacent points let choices = [(ll, left, right), (left, right, rr)]; for &(ai, current_point, bi) in &choices { if ai as usize >= max || bi as usize >= max { // Out of bounds, i.e. we're on one edge continue; } let area = Triangle( orig.0[ai as usize], orig.0[current_point as usize], orig.0[bi as usize], ) .area() .abs(); pq.push(VScore { area, current: current_point as usize, left: ai as usize, right: bi as usize, intersector: (), }); } } // Filter out the points that have been deleted, returning remaining point indices orig.0 .iter() .enumerate() .zip(adjacent.iter()) .filter_map(|(tup, adj)| if *adj != (0, 0) { Some(tup.0) } else { None }) .collect::<Vec<usize>>() } // Wrapper for visvalingam_indices, mapping indices back to points fn visvalingam<T>(orig: &LineString<T>, epsilon: &T) -> Vec<Coordinate<T>> where T: Float, { let subset = visvalingam_indices(orig, epsilon); // filter orig using the indices // using get would be more robust here, but the input subset is guaranteed to be valid in this case orig.0 .iter() .zip(subset.iter()) .map(|(_, s)| orig[*s]) .collect() } /// Wrap the actual VW function so the R* Tree can be shared. // this ensures that shell and rings have access to all segments, so // intersections between outer and inner rings are detected fn vwp_wrapper<T>( geomtype: &GeomSettings, exterior: &LineString<T>, interiors: Option<&[LineString<T>]>, epsilon: &T, ) -> Vec<Vec<Coordinate<T>>> where T: Float + RTreeNum, { let mut rings = vec![]; // Populate R* tree with exterior and interior samples, if any let mut tree: RTree<Line<_>> = RTree::bulk_load( exterior .lines() .chain( interiors .iter() .flat_map(|ring| *ring) .flat_map(|line_string| line_string.lines()), ) .collect::<Vec<_>>(), ); // Simplify shell rings.push(visvalingam_preserve( geomtype, &exterior, epsilon, &mut tree, )); // Simplify interior rings, if any if let Some(interior_rings) = interiors { for ring in interior_rings { rings.push(visvalingam_preserve(geomtype, &ring, epsilon, &mut tree)) } } rings } /// Visvalingam-Whyatt with self-intersection detection to preserve topologies /// this is a port of the technique at https://www.jasondavies.com/simplify/ fn visvalingam_preserve<T>( geomtype: &GeomSettings, orig: &LineString<T>, epsilon: &T, tree: &mut RTree<Line<T>>, ) -> Vec<Coordinate<T>> where T: Float + RTreeNum, { if orig.0.len() < 3 { return orig.0.to_vec(); } let max = orig.0.len(); let mut counter = orig.0.len(); // Adjacent retained points. Simulating the points in a // linked list with indices into `orig`. Big number (larger than or equal to // `max`) means no next element, and (0, 0) means deleted element. let mut adjacent: Vec<_> = (0..orig.0.len()) .map(|i| { if i == 0 { (-1_i32, 1_i32) } else { ((i - 1) as i32, (i + 1) as i32) } }) .collect(); // Store all the triangles in a minimum priority queue, based on their area. // // Invalid triangles are *not* removed if / when points are removed; they're // handled by skipping them as necessary in the main loop by checking the // corresponding entry in adjacent for (0, 0) values // Compute the initial triangles let mut pq = orig .triangles() .enumerate() .map(|(i, triangle)| VScore { area: triangle.area().abs(), current: i + 1, left: i, right: i + 2, intersector: false, }) .collect::<BinaryHeap<VScore<T, bool>>>(); // While there are still points for which the associated triangle // has an area below the epsilon while let Some(mut smallest) = pq.pop() { if smallest.area > *epsilon { continue; } if counter <= geomtype.initial_min { // we can't remove any more points no matter what break; } let (left, right) = adjacent[smallest.current]; // A point in this triangle has been removed since this VScore // was created, so skip it if left as i32 != smallest.left as i32 || right as i32 != smallest.right as i32 { continue; } // if removal of this point causes a self-intersection, we also remove the previous point // that removal alters the geometry, removing the self-intersection // HOWEVER if we're within 2 points of the absolute minimum, we can't remove this point or the next // because we could then no longer form a valid geometry if removal of next also caused an intersection. // The simplification process is thus over. smallest.intersector = tree_intersect(tree, &smallest, &orig.0); if smallest.intersector && counter <= geomtype.min_points { break; } // We've got a valid triangle, and its area is smaller than epsilon, so // remove it from the simulated "linked list" adjacent[smallest.current as usize] = (0, 0); counter -= 1; // Remove stale segments from R* tree let left_point = Point(orig.0[left as usize]); let middle_point = Point(orig.0[smallest.current]); let right_point = Point(orig.0[right as usize]); let line_1 = Line::new(left_point, middle_point); let line_2 = Line::new(middle_point, right_point); assert!(tree.remove(&line_1).is_some()); assert!(tree.remove(&line_2).is_some()); // Restore continous line segment tree.insert(Line::new(left_point, right_point)); // Now recompute the adjacent triangle(s), using left and right adjacent points let (ll, _) = adjacent[left as usize]; let (_, rr) = adjacent[right as usize]; adjacent[left as usize] = (ll, right); adjacent[right as usize] = (left, rr); let choices = [(ll, left, right), (left, right, rr)]; for &(ai, current_point, bi) in &choices { if ai as usize >= max || bi as usize >= max { // Out of bounds, i.e. we're on one edge continue; } let new = Triangle( orig.0[ai as usize], orig.0[current_point as usize], orig.0[bi as usize], ); // The current point causes a self-intersection, and this point precedes it // we ensure it gets removed next by demoting its area to negative epsilon let temp_area = if smallest.intersector && (current_point as usize) < smallest.current { -*epsilon } else { new.area().abs() }; let new_triangle = VScore { area: temp_area, current: current_point as usize, left: ai as usize, right: bi as usize, intersector: false, }; // push re-computed triangle onto heap pq.push(new_triangle); } } // Filter out the points that have been deleted, returning remaining points orig.0 .iter() .zip(adjacent.iter()) .filter_map(|(tup, adj)| if *adj != (0, 0) { Some(*tup) } else { None }) .collect() } /// is p1 -> p2 -> p3 wound counterclockwise? fn ccw<T>(p1: Point<T>, p2: Point<T>, p3: Point<T>) -> bool where T: Float, { (p3.y() - p1.y()) * (p2.x() - p1.x()) > (p2.y() - p1.y()) * (p3.x() - p1.x()) } /// checks whether line segments with p1-p4 as their start and endpoints touch or cross fn cartesian_intersect<T>(p1: Point<T>, p2: Point<T>, p3: Point<T>, p4: Point<T>) -> bool where T: Float, { (ccw(p1, p3, p4) ^ ccw(p2, p3, p4)) & (ccw(p1, p2, p3) ^ ccw(p1, p2, p4)) } /// check whether a triangle's edges intersect with any other edges of the LineString fn tree_intersect<T>( tree: &RTree<Line<T>>, triangle: &VScore<T, bool>, orig: &[Coordinate<T>], ) -> bool where T: Float + RTreeNum, { let point_a = orig[triangle.left]; let point_c = orig[triangle.right]; let bounding_rect = Triangle( orig[triangle.left], orig[triangle.current], orig[triangle.right], ) .bounding_rect(); let br = Point::new(bounding_rect.min().x, bounding_rect.min().y); let tl = Point::new(bounding_rect.max().x, bounding_rect.max().y); tree.locate_in_envelope_intersecting(&rstar::AABB::from_corners(br, tl)) .any(|c| { // triangle start point, end point let (ca, cb) = c.points(); ca.0 != point_a && ca.0 != point_c && cb.0 != point_a && cb.0 != point_c && cartesian_intersect(ca, cb, Point(point_a), Point(point_c)) }) } /// Simplifies a geometry. /// /// Polygons are simplified by running the algorithm on all their constituent rings. This may /// result in invalid Polygons, and has no guarantee of preserving topology. Multi* objects are /// simplified by simplifying all their constituent geometries individually. pub trait SimplifyVW<T, Epsilon = T> { /// Returns the simplified representation of a geometry, using the [Visvalingam-Whyatt](http://www.tandfonline.com/doi/abs/10.1179/000870493786962263) algorithm /// /// See [here](https://bost.ocks.org/mike/simplify/) for a graphical explanation /// /// # Examples /// /// ``` /// use geo::algorithm::simplifyvw::SimplifyVW; /// use geo::{LineString, Point}; /// /// let mut vec = Vec::new(); /// vec.push(Point::new(5.0, 2.0)); /// vec.push(Point::new(3.0, 8.0)); /// vec.push(Point::new(6.0, 20.0)); /// vec.push(Point::new(7.0, 25.0)); /// vec.push(Point::new(10.0, 10.0)); /// let linestring = LineString::from(vec); /// let mut compare = Vec::new(); /// compare.push(Point::new(5.0, 2.0)); /// compare.push(Point::new(7.0, 25.0)); /// compare.push(Point::new(10.0, 10.0)); /// let ls_compare = LineString::from(compare); /// let simplified = linestring.simplifyvw(&30.0); /// assert_eq!(simplified, ls_compare) /// ``` fn simplifyvw(&self, epsilon: &T) -> Self where T: Float; } /// Simplifies a geometry, returning the retained _indices_ of the output /// /// This operation uses the Visvalingam-Whyatt algorithm, /// and does **not** guarantee that the returned geometry is valid. pub trait SimplifyVwIdx<T, Epsilon = T> { /// Returns the simplified representation of a geometry, using the [Visvalingam-Whyatt](http://www.tandfonline.com/doi/abs/10.1179/000870493786962263) algorithm /// /// See [here](https://bost.ocks.org/mike/simplify/) for a graphical explanation /// /// # Examples /// /// ``` /// use geo::algorithm::simplifyvw::SimplifyVwIdx; /// use geo::{LineString, Point}; /// /// let mut vec = Vec::new(); /// vec.push(Point::new(5.0, 2.0)); /// vec.push(Point::new(3.0, 8.0)); /// vec.push(Point::new(6.0, 20.0)); /// vec.push(Point::new(7.0, 25.0)); /// vec.push(Point::new(10.0, 10.0)); /// let linestring = LineString::from(vec); /// let mut compare = Vec::new(); /// compare.push(0_usize); /// compare.push(3_usize); /// compare.push(4_usize); /// let simplified = linestring.simplifyvw_idx(&30.0); /// assert_eq!(simplified, compare) /// ``` fn simplifyvw_idx(&self, epsilon: &T) -> Vec<usize> where T: Float; } /// Simplifies a geometry, preserving its topology by removing self-intersections pub trait SimplifyVWPreserve<T, Epsilon = T> { /// Returns the simplified representation of a geometry, using a topology-preserving variant of the /// [Visvalingam-Whyatt](http://www.tandfonline.com/doi/abs/10.1179/000870493786962263) algorithm. /// /// See [here](https://www.jasondavies.com/simplify/) for a graphical explanation. /// /// The topology-preserving algorithm uses an [R* tree](../../../rstar/struct.RTree.html) to /// efficiently find candidate line segments which are tested for intersection with a given triangle. /// If intersections are found, the previous point (i.e. the left component of the current triangle) /// is also removed, altering the geometry and removing the intersection. /// /// In the example below, `(135.0, 68.0)` would be retained by the standard algorithm, /// forming triangle `(0, 1, 3),` which intersects with the segments `(280.0, 19.0), /// (117.0, 48.0)` and `(117.0, 48.0), (300,0, 40.0)`. By removing it, /// a new triangle with indices `(0, 3, 4)` is formed, which does not cause a self-intersection. /// /// **Note**: it is possible for the simplification algorithm to displace a Polygon's interior ring outside its shell. /// /// **Note**: if removal of a point causes a self-intersection, but the geometry only has `n + 2` /// points remaining (4 for a `LineString`, 6 for a `Polygon`), the point is retained and the /// simplification process ends. This is because there is no guarantee that removal of two points will remove /// the intersection, but removal of further points would leave too few points to form a valid geometry. /// /// # Examples /// /// ``` /// use geo::algorithm::simplifyvw::SimplifyVWPreserve; /// use geo::{LineString, Point}; /// /// let mut vec = Vec::new(); /// vec.push(Point::new(10., 60.)); /// vec.push(Point::new(135., 68.)); /// vec.push(Point::new(94., 48.)); /// vec.push(Point::new(126., 31.)); /// vec.push(Point::new(280., 19.)); /// vec.push(Point::new(117., 48.)); /// vec.push(Point::new(300., 40.)); /// vec.push(Point::new(301., 10.)); /// let linestring = LineString::from(vec); /// let mut compare = Vec::new(); /// compare.push(Point::new(10., 60.)); /// compare.push(Point::new(126., 31.)); /// compare.push(Point::new(280., 19.)); /// compare.push(Point::new(117., 48.)); /// compare.push(Point::new(300., 40.)); /// compare.push(Point::new(301., 10.)); /// let ls_compare = LineString::from(compare); /// let simplified = linestring.simplifyvw_preserve(&668.6); /// assert_eq!(simplified, ls_compare) /// ``` fn simplifyvw_preserve(&self, epsilon: &T) -> Self where T: Float + RTreeNum; } impl<T> SimplifyVWPreserve<T> for LineString<T> where T: Float + RTreeNum, { fn simplifyvw_preserve(&self, epsilon: &T) -> LineString<T> { let gt = GeomSettings { initial_min: 2, min_points: 4, geomtype: GeomType::Line, }; let mut simplified = vwp_wrapper(&gt, self, None, epsilon); LineString::from(simplified.pop().unwrap()) } } impl<T> SimplifyVWPreserve<T> for MultiLineString<T> where T: Float + RTreeNum, { fn simplifyvw_preserve(&self, epsilon: &T) -> MultiLineString<T> { MultiLineString( self.0 .iter() .map(|l| l.simplifyvw_preserve(epsilon)) .collect(), ) } } impl<T> SimplifyVWPreserve<T> for Polygon<T> where T: Float + RTreeNum, { fn simplifyvw_preserve(&self, epsilon: &T) -> Polygon<T> { let gt = GeomSettings { initial_min: 4, min_points: 6, geomtype: GeomType::Ring, }; let mut simplified = vwp_wrapper(&gt, self.exterior(), Some(self.interiors()), epsilon); let exterior = LineString::from(simplified.remove(0)); let interiors = simplified.into_iter().map(LineString::from).collect(); Polygon::new(exterior, interiors) } } impl<T> SimplifyVWPreserve<T> for MultiPolygon<T> where T: Float + RTreeNum, { fn simplifyvw_preserve(&self, epsilon: &T) -> MultiPolygon<T> { MultiPolygon( self.0 .iter() .map(|p| p.simplifyvw_preserve(epsilon)) .collect(), ) } } impl<T> SimplifyVW<T> for LineString<T> where T: Float, { fn simplifyvw(&self, epsilon: &T) -> LineString<T> { LineString::from(visvalingam(self, epsilon)) } } impl<T> SimplifyVwIdx<T> for LineString<T> where T: Float, { fn simplifyvw_idx(&self, epsilon: &T) -> Vec<usize> { visvalingam_indices(self, epsilon) } } impl<T> SimplifyVW<T> for MultiLineString<T> where T: Float, { fn simplifyvw(&self, epsilon: &T) -> MultiLineString<T> { MultiLineString(self.0.iter().map(|l| l.simplifyvw(epsilon)).collect()) } } impl<T> SimplifyVW<T> for Polygon<T> where T: Float, { fn simplifyvw(&self, epsilon: &T) -> Polygon<T> { Polygon::new( self.exterior().simplifyvw(epsilon), self.interiors() .iter() .map(|l| l.simplifyvw(epsilon)) .collect(), ) } } impl<T> SimplifyVW<T> for MultiPolygon<T> where T: Float, { fn simplifyvw(&self, epsilon: &T) -> MultiPolygon<T> { MultiPolygon(self.0.iter().map(|p| p.simplifyvw(epsilon)).collect()) } } #[cfg(test)] mod test { use super::{ cartesian_intersect, visvalingam, vwp_wrapper, GeomSettings, GeomType, SimplifyVW, SimplifyVWPreserve, }; use crate::{ line_string, point, polygon, Coordinate, LineString, MultiLineString, MultiPolygon, Point, Polygon, }; #[test] fn visvalingam_test() { // this is the PostGIS example let ls = line_string![ (x: 5.0, y: 2.0), (x: 3.0, y: 8.0), (x: 6.0, y: 20.0), (x: 7.0, y: 25.0), (x: 10.0, y: 10.0) ]; let correct = vec![(5.0, 2.0), (7.0, 25.0), (10.0, 10.0)]; let correct_ls: Vec<_> = correct .iter() .map(|e| Coordinate::from((e.0, e.1))) .collect(); let simplified = visvalingam(&ls, &30.); assert_eq!(simplified, correct_ls); } #[test] fn vwp_intersection_test() { // does the intersection check always work let a = point!(x: 1., y: 3.); let b = point!(x: 3., y: 1.); let c = point!(x: 3., y: 3.); let d = point!(x: 1., y: 1.); // cw + ccw assert_eq!(cartesian_intersect(a, b, c, d), true); // ccw + ccw assert_eq!(cartesian_intersect(b, a, c, d), true); // cw + cw assert_eq!(cartesian_intersect(a, b, d, c), true); // ccw + cw assert_eq!(cartesian_intersect(b, a, d, c), true); } #[test] fn simple_vwp_test() { // this LineString will have a self-intersection if the point with the // smallest associated area is removed // the associated triangle is (1, 2, 3), and has an area of 668.5 // the new triangle (0, 1, 3) self-intersects with triangle (3, 4, 5) // Point 1 must also be removed giving a final, valid // LineString of (0, 3, 4, 5, 6, 7) let ls = line_string![ (x: 10., y:60.), (x: 135., y: 68.), (x: 94., y: 48.), (x: 126., y: 31.), (x: 280., y: 19.), (x: 117., y: 48.), (x: 300., y: 40.), (x: 301., y: 10.) ]; let gt = &GeomSettings { initial_min: 2, min_points: 4, geomtype: GeomType::Line, }; let simplified = vwp_wrapper(&gt, &ls, None, &668.6); // this is the correct, non-intersecting LineString let correct = vec![ (10., 60.), (126., 31.), (280., 19.), (117., 48.), (300., 40.), (301., 10.), ]; let correct_ls: Vec<_> = correct .iter() .map(|e| Coordinate::from((e.0, e.1))) .collect(); assert_eq!(simplified[0], correct_ls); } #[test] fn retained_vwp_test() { // we would expect outer[2] to be removed, as its associated area // is below epsilon. However, this causes a self-intersection // with the inner ring, which would also trigger removal of outer[1], // leaving the geometry below min_points. It is thus retained. // Inner should also be reduced, but has points == initial_min for the Polygon type let outer = line_string![ (x: -54.4921875, y: 21.289374355860424), (x: -33.5, y: 56.9449741808516), (x: -22.5, y: 44.08758502824516), (x: -19.5, y: 23.241346102386135), (x: -54.4921875, y: 21.289374355860424) ]; let inner = line_string![ (x: -24.451171875, y: 35.266685523707665), (x: -29.513671875, y: 47.32027765985069), (x: -22.869140625, y: 43.80817468459856), (x: -24.451171875, y: 35.266685523707665) ]; let poly = Polygon::new(outer.clone(), vec![inner]); let simplified = poly.simplifyvw_preserve(&95.4); assert_eq!(simplified.exterior(), &outer); } #[test] fn remove_inner_point_vwp_test() { // we would expect outer[2] to be removed, as its associated area // is below epsilon. However, this causes a self-intersection // with the inner ring, which would also trigger removal of outer[1], // leaving the geometry below min_points. It is thus retained. // Inner should be reduced to four points by removing inner[2] let outer = line_string![ (x: -54.4921875, y: 21.289374355860424), (x: -33.5, y: 56.9449741808516), (x: -22.5, y: 44.08758502824516), (x: -19.5, y: 23.241346102386135), (x: -54.4921875, y: 21.289374355860424) ]; let inner = line_string![ (x: -24.451171875, y: 35.266685523707665), (x: -40.0, y: 45.), (x: -29.513671875, y: 47.32027765985069), (x: -22.869140625, y: 43.80817468459856), (x: -24.451171875, y: 35.266685523707665) ]; let correct_inner = line_string![ (x: -24.451171875, y: 35.266685523707665), (x: -40.0, y: 45.0), (x: -22.869140625, y: 43.80817468459856), (x: -24.451171875, y: 35.266685523707665) ]; let poly = Polygon::new(outer.clone(), vec![inner]); let simplified = poly.simplifyvw_preserve(&95.4); assert_eq!(simplified.exterior(), &outer); assert_eq!(simplified.interiors()[0], correct_inner); } #[test] fn very_long_vwp_test() { // simplify an 8k-point LineString, eliminating self-intersections let points = include!("test_fixtures/norway_main.rs"); let points_ls: Vec<_> = points.iter().map(|e| Point::new(e[0], e[1])).collect(); let gt = &GeomSettings { initial_min: 2, min_points: 4, geomtype: GeomType::Line, }; let simplified = vwp_wrapper(&gt, &points_ls.into(), None, &0.0005); assert_eq!(simplified[0].len(), 3278); } #[test] fn visvalingam_test_long() { // simplify a longer LineString let points = include!("test_fixtures/vw_orig.rs"); let points_ls: LineString<_> = points.iter().map(|e| Point::new(e[0], e[1])).collect(); let correct = include!("test_fixtures/vw_simplified.rs"); let correct_ls: Vec<_> = correct .iter() .map(|e| Coordinate::from((e[0], e[1]))) .collect(); let simplified = visvalingam(&points_ls, &0.0005); assert_eq!(simplified, correct_ls); } #[test] fn visvalingam_preserve_test_long() { // simplify a longer LineString using the preserve variant let points = include!("test_fixtures/vw_orig.rs"); let points_ls: LineString<_> = points.iter().map(|e| Point::new(e[0], e[1])).collect(); let correct = include!("test_fixtures/vw_simplified.rs"); let correct_ls: Vec<_> = correct.iter().map(|e| Point::new(e[0], e[1])).collect(); let simplified = LineString::from(points_ls).simplifyvw_preserve(&0.0005); assert_eq!(simplified, LineString::from(correct_ls)); } #[test] fn visvalingam_test_empty_linestring() { let vec: Vec<[f32; 2]> = Vec::new(); let compare = Vec::new(); let simplified = visvalingam(&LineString::from(vec), &1.0); assert_eq!(simplified, compare); } #[test] fn visvalingam_test_two_point_linestring() { let mut vec = Vec::new(); vec.push(Point::new(0.0, 0.0)); vec.push(Point::new(27.8, 0.1)); let mut compare = Vec::new(); compare.push(Coordinate::from((0.0, 0.0))); compare.push(Coordinate::from((27.8, 0.1))); let simplified = visvalingam(&LineString::from(vec), &1.0); assert_eq!(simplified, compare); } #[test] fn multilinestring() { // this is the PostGIS example let points = vec![ (5.0, 2.0), (3.0, 8.0), (6.0, 20.0), (7.0, 25.0), (10.0, 10.0), ]; let points_ls: Vec<_> = points.iter().map(|e| Point::new(e.0, e.1)).collect(); let correct = vec![(5.0, 2.0), (7.0, 25.0), (10.0, 10.0)]; let correct_ls: Vec<_> = correct.iter().map(|e| Point::new(e.0, e.1)).collect(); let mline = MultiLineString(vec![LineString::from(points_ls)]); assert_eq!( mline.simplifyvw(&30.), MultiLineString(vec![LineString::from(correct_ls)]) ); } #[test] fn polygon() { let poly = polygon![ (x: 0., y: 0.), (x: 0., y: 10.), (x: 5., y: 11.), (x: 10., y: 10.), (x: 10., y: 0.), (x: 0., y: 0.), ]; let poly2 = poly.simplifyvw(&10.); assert_eq!( poly2, polygon![ (x: 0., y: 0.), (x: 0., y: 10.), (x: 10., y: 10.), (x: 10., y: 0.), (x: 0., y: 0.), ], ); } #[test] fn multipolygon() { let mpoly = MultiPolygon(vec![Polygon::new( LineString::from(vec![ (0., 0.), (0., 10.), (5., 11.), (10., 10.), (10., 0.), (0., 0.), ]), vec![], )]); let mpoly2 = mpoly.simplifyvw(&10.); assert_eq!( mpoly2, MultiPolygon(vec![Polygon::new( LineString::from(vec![(0., 0.), (0., 10.), (10., 10.), (10., 0.), (0., 0.)]), vec![], )]) ); } }
//! Implements arbitrary-precision arithmetic (big numbers). //! The following numeric types are supported: //! //! ```ignore //! Int signed integers //! ``` //! //mod arith; mod int; //mod nat; /// The largest number base accepted for string conversions. pub const MAX_BASE: u8 = 10 + (b'z' - b'a' + 1) + (b'Z' - b'A' + 1); pub use int::*; //pub type Word = usize;
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type IItemEnumerator = *mut ::core::ffi::c_void; pub type ISettingsContext = *mut ::core::ffi::c_void; pub type ISettingsEngine = *mut ::core::ffi::c_void; pub type ISettingsIdentity = *mut ::core::ffi::c_void; pub type ISettingsItem = *mut ::core::ffi::c_void; pub type ISettingsNamespace = *mut ::core::ffi::c_void; pub type ISettingsResult = *mut ::core::ffi::c_void; pub type ITargetInfo = *mut ::core::ffi::c_void; pub const LIMITED_VALIDATION_MODE: u32 = 1u32; pub const LINK_STORE_TO_ENGINE_INSTANCE: u32 = 1u32; pub const SettingsEngine: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 2675801013, data2: 8371, data3: 4570, data4: [129, 165, 0, 48, 241, 100, 46, 60] }; pub const WCM_E_ABORTOPERATION: ::windows_sys::core::HRESULT = -2145255384i32; pub const WCM_E_ASSERTIONFAILED: ::windows_sys::core::HRESULT = -2145255398i32; pub const WCM_E_ATTRIBUTENOTALLOWED: ::windows_sys::core::HRESULT = -2145255420i32; pub const WCM_E_ATTRIBUTENOTFOUND: ::windows_sys::core::HRESULT = -2145255421i32; pub const WCM_E_CONFLICTINGASSERTION: ::windows_sys::core::HRESULT = -2145255399i32; pub const WCM_E_CYCLICREFERENCE: ::windows_sys::core::HRESULT = -2145255389i32; pub const WCM_E_DUPLICATENAME: ::windows_sys::core::HRESULT = -2145255397i32; pub const WCM_E_EXPRESSIONNOTFOUND: ::windows_sys::core::HRESULT = -2145255408i32; pub const WCM_E_HANDLERNOTFOUND: ::windows_sys::core::HRESULT = -2145255394i32; pub const WCM_E_INTERNALERROR: ::windows_sys::core::HRESULT = -2145255424i32; pub const WCM_E_INVALIDATTRIBUTECOMBINATION: ::windows_sys::core::HRESULT = -2145255385i32; pub const WCM_E_INVALIDDATATYPE: ::windows_sys::core::HRESULT = -2145255416i32; pub const WCM_E_INVALIDEXPRESSIONSYNTAX: ::windows_sys::core::HRESULT = -2145255401i32; pub const WCM_E_INVALIDHANDLERSYNTAX: ::windows_sys::core::HRESULT = -2145255393i32; pub const WCM_E_INVALIDKEY: ::windows_sys::core::HRESULT = -2145255396i32; pub const WCM_E_INVALIDLANGUAGEFORMAT: ::windows_sys::core::HRESULT = -2145255410i32; pub const WCM_E_INVALIDPATH: ::windows_sys::core::HRESULT = -2145255413i32; pub const WCM_E_INVALIDPROCESSORFORMAT: ::windows_sys::core::HRESULT = -2145255382i32; pub const WCM_E_INVALIDSTREAM: ::windows_sys::core::HRESULT = -2145255395i32; pub const WCM_E_INVALIDVALUE: ::windows_sys::core::HRESULT = -2145255419i32; pub const WCM_E_INVALIDVALUEFORMAT: ::windows_sys::core::HRESULT = -2145255418i32; pub const WCM_E_INVALIDVERSIONFORMAT: ::windows_sys::core::HRESULT = -2145255411i32; pub const WCM_E_KEYNOTCHANGEABLE: ::windows_sys::core::HRESULT = -2145255409i32; pub const WCM_E_MANIFESTCOMPILATIONFAILED: ::windows_sys::core::HRESULT = -2145255390i32; pub const WCM_E_MISSINGCONFIGURATION: ::windows_sys::core::HRESULT = -2145255383i32; pub const WCM_E_MIXTYPEASSERTION: ::windows_sys::core::HRESULT = -2145255388i32; pub const WCM_E_NAMESPACEALREADYREGISTERED: ::windows_sys::core::HRESULT = -2145255403i32; pub const WCM_E_NAMESPACENOTFOUND: ::windows_sys::core::HRESULT = -2145255404i32; pub const WCM_E_NOTIFICATIONNOTFOUND: ::windows_sys::core::HRESULT = -2145255400i32; pub const WCM_E_NOTPOSITIONED: ::windows_sys::core::HRESULT = -2145255415i32; pub const WCM_E_NOTSUPPORTEDFUNCTION: ::windows_sys::core::HRESULT = -2145255387i32; pub const WCM_E_READONLYITEM: ::windows_sys::core::HRESULT = -2145255414i32; pub const WCM_E_RESTRICTIONFAILED: ::windows_sys::core::HRESULT = -2145255391i32; pub const WCM_E_SOURCEMANEMPTYVALUE: ::windows_sys::core::HRESULT = -2145255381i32; pub const WCM_E_STATENODENOTALLOWED: ::windows_sys::core::HRESULT = -2145255422i32; pub const WCM_E_STATENODENOTFOUND: ::windows_sys::core::HRESULT = -2145255423i32; pub const WCM_E_STORECORRUPTED: ::windows_sys::core::HRESULT = -2145255402i32; pub const WCM_E_SUBSTITUTIONNOTFOUND: ::windows_sys::core::HRESULT = -2145255407i32; pub const WCM_E_TYPENOTSPECIFIED: ::windows_sys::core::HRESULT = -2145255417i32; pub const WCM_E_UNKNOWNRESULT: ::windows_sys::core::HRESULT = -2145251325i32; pub const WCM_E_USERALREADYREGISTERED: ::windows_sys::core::HRESULT = -2145255406i32; pub const WCM_E_USERNOTFOUND: ::windows_sys::core::HRESULT = -2145255405i32; pub const WCM_E_VALIDATIONFAILED: ::windows_sys::core::HRESULT = -2145255392i32; pub const WCM_E_VALUETOOBIG: ::windows_sys::core::HRESULT = -2145255386i32; pub const WCM_E_WRONGESCAPESTRING: ::windows_sys::core::HRESULT = -2145255412i32; pub const WCM_SETTINGS_ID_FLAG_DEFINITION: u32 = 1u32; pub const WCM_SETTINGS_ID_FLAG_REFERENCE: u32 = 0u32; pub const WCM_S_ATTRIBUTENOTALLOWED: ::windows_sys::core::HRESULT = 2232325i32; pub const WCM_S_ATTRIBUTENOTFOUND: ::windows_sys::core::HRESULT = 2232321i32; pub const WCM_S_INTERNALERROR: ::windows_sys::core::HRESULT = 2232320i32; pub const WCM_S_INVALIDATTRIBUTECOMBINATION: ::windows_sys::core::HRESULT = 2232324i32; pub const WCM_S_LEGACYSETTINGWARNING: ::windows_sys::core::HRESULT = 2232322i32; pub const WCM_S_NAMESPACENOTFOUND: ::windows_sys::core::HRESULT = 2232326i32; pub type WcmDataType = i32; pub const dataTypeByte: WcmDataType = 1i32; pub const dataTypeSByte: WcmDataType = 2i32; pub const dataTypeUInt16: WcmDataType = 3i32; pub const dataTypeInt16: WcmDataType = 4i32; pub const dataTypeUInt32: WcmDataType = 5i32; pub const dataTypeInt32: WcmDataType = 6i32; pub const dataTypeUInt64: WcmDataType = 7i32; pub const dataTypeInt64: WcmDataType = 8i32; pub const dataTypeBoolean: WcmDataType = 11i32; pub const dataTypeString: WcmDataType = 12i32; pub const dataTypeFlagArray: WcmDataType = 32768i32; pub type WcmNamespaceAccess = i32; pub const ReadOnlyAccess: WcmNamespaceAccess = 1i32; pub const ReadWriteAccess: WcmNamespaceAccess = 2i32; pub type WcmNamespaceEnumerationFlags = i32; pub const SharedEnumeration: WcmNamespaceEnumerationFlags = 1i32; pub const UserEnumeration: WcmNamespaceEnumerationFlags = 2i32; pub const AllEnumeration: WcmNamespaceEnumerationFlags = 3i32; pub type WcmRestrictionFacets = i32; pub const restrictionFacetMaxLength: WcmRestrictionFacets = 1i32; pub const restrictionFacetEnumeration: WcmRestrictionFacets = 2i32; pub const restrictionFacetMaxInclusive: WcmRestrictionFacets = 4i32; pub const restrictionFacetMinInclusive: WcmRestrictionFacets = 8i32; pub type WcmSettingType = i32; pub const settingTypeScalar: WcmSettingType = 1i32; pub const settingTypeComplex: WcmSettingType = 2i32; pub const settingTypeList: WcmSettingType = 3i32; pub type WcmTargetMode = i32; pub const OfflineMode: WcmTargetMode = 1i32; pub const OnlineMode: WcmTargetMode = 2i32; pub type WcmUserStatus = i32; pub const UnknownStatus: WcmUserStatus = 0i32; pub const UserRegistered: WcmUserStatus = 1i32; pub const UserUnregistered: WcmUserStatus = 2i32; pub const UserLoaded: WcmUserStatus = 3i32; pub const UserUnloaded: WcmUserStatus = 4i32;
use std::collections::HashMap; fn main() {} fn num_as_roman(num: i32) -> String { let mut kode = HashMap::new(); kode.insert("I", 1); kode.insert("V", 5); kode.insert("X", 10); kode.insert("L", 50); kode.insert("C", 100); kode.insert("D", 500); kode.insert("M", 1_000); "Hello".to_owned() } #[test] fn test_kembalian() { assert_eq!(num_as_roman(182), "CLXXXII"); // C = 100 // L = 50 // XXX = 30 // II = 2 assert_eq!(num_as_roman(1990), "MCMXC"); // M = 1_000 // C = 100 // X = 10 assert_eq!(num_as_roman(1875), "MDCCCLXXV"); }
use std::env; use regex::Regex; use std::{fs, io}; use std::io::Read; use std::fs::File; use regex::RegexSet; use std::path::Path; use std::path::PathBuf; fn collect_file_from_dir(dir: &Path) -> io::Result<Vec<PathBuf>> { let mut result: Vec<PathBuf> = vec![]; if dir.is_dir() { for entry in fs::read_dir(dir)? { let entry = entry?; let path = entry.path(); if path.is_dir() { result.extend(collect_file_from_dir(&path)?); } else { result.push(path); } } } Ok(result) } fn search(entry: String) { let args: Vec<String> = env::args().collect(); let path = Path::new(&entry); let display = path.display(); let mut file = match File::open(&path) { Err(_) => panic!(""), Ok(file) => file, }; let mut s = String::new(); match file.read_to_string(&mut s) { Err(_) => print!(""), Ok(_) => { let re = Regex::new(&args[1]).unwrap(); if re.is_match(&s) { let split = s.split("\n"); let lines = split.collect::<Vec<&str>>(); println!("{}:", display); for i in 0..lines.len() { if lines[i] != "" && re.is_match(&lines[i]) { println!("{}| {}", i + 1, lines[i]); } } } } } } fn search_content(raw_path: String) { let args: Vec<String> = env::args().collect(); if args.len() == 2 { search(raw_path.clone()); } else if args.len() > 2 { if args.iter().position(|r| r == "--include") != None && args.iter().position(|r| r == "--ignore") != None { let include_index = args.iter().position(|r| r == "--include").unwrap(); let ignore_index = args.iter().position(|r| r == "--ignore").unwrap(); if include_index < ignore_index { let include_set = RegexSet::new(&args[include_index + 1..ignore_index]).unwrap(); let include_matches: Vec<_> = include_set.matches(&raw_path).into_iter().collect(); let ignore_set = RegexSet::new(&args[ignore_index + 1..]).unwrap(); let ignore_matches: Vec<_> = ignore_set.matches(&raw_path).into_iter().collect(); let cloned = raw_path.clone(); if include_matches.len() > 0 && ignore_matches.len() == 0 { search(cloned); } } else if ignore_index < include_index { let ignore_set = RegexSet::new(&args[ignore_index + 1..include_index]).unwrap(); let ignore_matches: Vec<_> = ignore_set.matches(&raw_path).into_iter().collect(); let include_set = RegexSet::new(&args[include_index + 1..]).unwrap(); let include_matches: Vec<_> = include_set.matches(&raw_path).into_iter().collect(); let cloned = raw_path.clone(); if include_matches.len() > 0 && ignore_matches.len() == 0 { search(cloned); } } } else if args.iter().position(|r| r == "--include") != None { let include_index = args.iter().position(|r| r == "--include").unwrap(); let include_set = RegexSet::new(&args[include_index + 1..]).unwrap(); let include_matches: Vec<_> = include_set.matches(&raw_path).into_iter().collect(); let cloned = raw_path.clone(); if include_matches.len() > 0 { search(cloned); } } else if args.iter().position(|r| r == "--ignore") != None { let ignore_index = args.iter().position(|r| r == "--ignore").unwrap(); let ignore_set = RegexSet::new(&args[ignore_index + 1..]).unwrap(); let ignore_matches: Vec<_> = ignore_set.matches(&raw_path).into_iter().collect(); let cloned = raw_path.clone(); if ignore_matches.len() == 0 { search(cloned); } } else { panic!("Unknown option"); } } } fn main() { let args: Vec<String> = env::args().collect(); if args.len() >= 2 { let current_dir = Path::new("."); let paths = collect_file_from_dir(current_dir); for path in paths { for entry in path { let entry_path = entry.to_string_lossy().to_string(); search_content(entry_path); } } } else { println!("text-search [pattern-or-regexp-in-file] [--ignore|--include] [pattern-or-regexp-in-path]"); } }
/// These utilities are intended for use by the test suite. use std::collections::HashMap; use game::{Game, GamePhase, GameStatus}; use id::{Id, get_id}; use player::Player; use zone::{Zone, ZoneDetails}; /// A test method for quickly bootstrapping a valid two-player `Game`. pub fn new_two_player_game() -> Game { let mut game = Game { zones: HashMap::new(), objects: HashMap::new(), mana_pools: HashMap::new(), players: HashMap::new(), player_turn_order: Vec::new(), current_phase: GamePhase::Main, current_status: GameStatus::NeedsPlayerAction, // We'll mutate these before we return active_player: None, priority_player: None, }; let battlefield = Zone { id: get_id(), details: ZoneDetails::Battlefield, }; game.zones.insert(battlefield.id, battlefield); let player1 = Player { id: get_id(), }; game.active_player = Some(player1.id); game.priority_player = Some(player1.id); game.mana_pools.insert(player1.id, 0); let player1_hand = Zone { id: get_id(), details: ZoneDetails::Hand { player_id: player1.id, }, }; game.player_turn_order.push(player1.id); game.players.insert(player1.id, player1); game.zones.insert(player1_hand.id, player1_hand); let player2 = Player { id: get_id(), }; game.mana_pools.insert(player2.id, 0); let player2_hand = Zone { id: get_id(), details: ZoneDetails::Hand { player_id: player2.id, }, }; game.player_turn_order.push(player2.id); game.players.insert(player2.id, player2); game.zones.insert(player2_hand.id, player2_hand); game } pub fn get_hand_id(game: &Game, target_player_id: Id) -> Id { game.find_zone_id(|zone| { match zone.details { ZoneDetails::Hand { player_id } => player_id == target_player_id, _ => false, } }) .unwrap() } pub fn get_battlefield_id(game: &Game) -> Id { game.find_zone_id(|zone| { match zone.details { ZoneDetails::Battlefield => true, _ => false, } }) .unwrap() }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] pub const FACILITY_PINT_STATUS_CODE: u32 = 240u32; pub const FACILITY_RTC_INTERFACE: u32 = 238u32; pub const FACILITY_SIP_STATUS_CODE: u32 = 239u32; #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct INetworkTransportSettings(pub ::windows::core::IUnknown); impl INetworkTransportSettings { #[cfg(feature = "Win32_Networking_WinSock")] pub unsafe fn ApplySetting(&self, settingid: *const super::super::Networking::WinSock::TRANSPORT_SETTING_ID, lengthin: u32, valuein: *const u8, lengthout: *mut u32, valueout: *mut *mut u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(settingid), ::core::mem::transmute(lengthin), ::core::mem::transmute(valuein), ::core::mem::transmute(lengthout), ::core::mem::transmute(valueout)).ok() } #[cfg(feature = "Win32_Networking_WinSock")] pub unsafe fn QuerySetting(&self, settingid: *const super::super::Networking::WinSock::TRANSPORT_SETTING_ID, lengthin: u32, valuein: *const u8, lengthout: *mut u32, valueout: *mut *mut u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(settingid), ::core::mem::transmute(lengthin), ::core::mem::transmute(valuein), ::core::mem::transmute(lengthout), ::core::mem::transmute(valueout)).ok() } } unsafe impl ::windows::core::Interface for INetworkTransportSettings { type Vtable = INetworkTransportSettings_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5e7abb2c_f2c1_4a61_bd35_deb7a08ab0f1); } impl ::core::convert::From<INetworkTransportSettings> for ::windows::core::IUnknown { fn from(value: INetworkTransportSettings) -> Self { value.0 } } impl ::core::convert::From<&INetworkTransportSettings> for ::windows::core::IUnknown { fn from(value: &INetworkTransportSettings) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for INetworkTransportSettings { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a INetworkTransportSettings { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct INetworkTransportSettings_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Networking_WinSock")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, settingid: *const super::super::Networking::WinSock::TRANSPORT_SETTING_ID, lengthin: u32, valuein: *const u8, lengthout: *mut u32, valueout: *mut *mut u8) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Networking_WinSock"))] usize, #[cfg(feature = "Win32_Networking_WinSock")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, settingid: *const super::super::Networking::WinSock::TRANSPORT_SETTING_ID, lengthin: u32, valuein: *const u8, lengthout: *mut u32, valueout: *mut *mut u8) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Networking_WinSock"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct INotificationTransportSync(pub ::windows::core::IUnknown); impl INotificationTransportSync { pub unsafe fn CompleteDelivery(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Flush(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } } unsafe impl ::windows::core::Interface for INotificationTransportSync { type Vtable = INotificationTransportSync_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x79eb1402_0ab8_49c0_9e14_a1ae4ba93058); } impl ::core::convert::From<INotificationTransportSync> for ::windows::core::IUnknown { fn from(value: INotificationTransportSync) -> Self { value.0 } } impl ::core::convert::From<&INotificationTransportSync> for ::windows::core::IUnknown { fn from(value: &INotificationTransportSync) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for INotificationTransportSync { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a INotificationTransportSync { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct INotificationTransportSync_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCBuddy(pub ::windows::core::IUnknown); impl IRTCBuddy { #[cfg(feature = "Win32_Foundation")] pub unsafe fn PresentityURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPresentityURI<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrname: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), bstrname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Data(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdata: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrdata.into_param().abi()).ok() } pub unsafe fn Persistent(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } pub unsafe fn SetPersistent(&self, fpersistent: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(fpersistent)).ok() } pub unsafe fn Status(&self) -> ::windows::core::Result<RTC_PRESENCE_STATUS> { let mut result__: <RTC_PRESENCE_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PRESENCE_STATUS>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Notes(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCBuddy { type Vtable = IRTCBuddy_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfcb136c8_7b90_4e0c_befe_56edf0ba6f1c); } impl ::core::convert::From<IRTCBuddy> for ::windows::core::IUnknown { fn from(value: IRTCBuddy) -> Self { value.0 } } impl ::core::convert::From<&IRTCBuddy> for ::windows::core::IUnknown { fn from(value: &IRTCBuddy) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCBuddy { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCBuddy { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCBuddy> for IRTCPresenceContact { fn from(value: IRTCBuddy) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCBuddy> for IRTCPresenceContact { fn from(value: &IRTCBuddy) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCPresenceContact> for IRTCBuddy { fn into_param(self) -> ::windows::core::Param<'a, IRTCPresenceContact> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCPresenceContact> for &IRTCBuddy { fn into_param(self) -> ::windows::core::Param<'a, IRTCPresenceContact> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCBuddy_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrpresentityuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfpersistent: *mut i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fpersistent: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstatus: *mut RTC_PRESENCE_STATUS) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrnotes: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCBuddy2(pub ::windows::core::IUnknown); impl IRTCBuddy2 { #[cfg(feature = "Win32_Foundation")] pub unsafe fn PresentityURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPresentityURI<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrname: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), bstrname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Data(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdata: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrdata.into_param().abi()).ok() } pub unsafe fn Persistent(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } pub unsafe fn SetPersistent(&self, fpersistent: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(fpersistent)).ok() } pub unsafe fn Status(&self) -> ::windows::core::Result<RTC_PRESENCE_STATUS> { let mut result__: <RTC_PRESENCE_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PRESENCE_STATUS>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Notes(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile2> { let mut result__: <IRTCProfile2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile2>(result__) } pub unsafe fn Refresh(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn EnumerateGroups(&self) -> ::windows::core::Result<IRTCEnumGroups> { let mut result__: <IRTCEnumGroups as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumGroups>(result__) } pub unsafe fn Groups(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn PresenceProperty(&self, enproperty: RTC_PRESENCE_PROPERTY) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(enproperty), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn EnumeratePresenceDevices(&self) -> ::windows::core::Result<IRTCEnumPresenceDevices> { let mut result__: <IRTCEnumPresenceDevices as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumPresenceDevices>(result__) } pub unsafe fn PresenceDevices(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } pub unsafe fn SubscriptionType(&self) -> ::windows::core::Result<RTC_BUDDY_SUBSCRIPTION_TYPE> { let mut result__: <RTC_BUDDY_SUBSCRIPTION_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_BUDDY_SUBSCRIPTION_TYPE>(result__) } } unsafe impl ::windows::core::Interface for IRTCBuddy2 { type Vtable = IRTCBuddy2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x102f9588_23e7_40e3_954d_cd7a1d5c0361); } impl ::core::convert::From<IRTCBuddy2> for ::windows::core::IUnknown { fn from(value: IRTCBuddy2) -> Self { value.0 } } impl ::core::convert::From<&IRTCBuddy2> for ::windows::core::IUnknown { fn from(value: &IRTCBuddy2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCBuddy2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCBuddy2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCBuddy2> for IRTCBuddy { fn from(value: IRTCBuddy2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCBuddy2> for IRTCBuddy { fn from(value: &IRTCBuddy2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCBuddy> for IRTCBuddy2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCBuddy> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCBuddy> for &IRTCBuddy2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCBuddy> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } impl ::core::convert::From<IRTCBuddy2> for IRTCPresenceContact { fn from(value: IRTCBuddy2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCBuddy2> for IRTCPresenceContact { fn from(value: &IRTCBuddy2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCPresenceContact> for IRTCBuddy2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCPresenceContact> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCPresenceContact> for &IRTCBuddy2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCPresenceContact> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCBuddy2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrpresentityuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfpersistent: *mut i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fpersistent: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstatus: *mut RTC_PRESENCE_STATUS) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrnotes: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enproperty: RTC_PRESENCE_PROPERTY, pbstrproperty: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenumdevices: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppdevicescollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pensubscriptiontype: *mut RTC_BUDDY_SUBSCRIPTION_TYPE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCBuddyEvent(pub ::windows::core::IUnknown); impl IRTCBuddyEvent { pub unsafe fn Buddy(&self) -> ::windows::core::Result<IRTCBuddy> { let mut result__: <IRTCBuddy as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCBuddy>(result__) } } unsafe impl ::windows::core::Interface for IRTCBuddyEvent { type Vtable = IRTCBuddyEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf36d755d_17e6_404e_954f_0fc07574c78d); } impl ::core::convert::From<IRTCBuddyEvent> for ::windows::core::IUnknown { fn from(value: IRTCBuddyEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCBuddyEvent> for ::windows::core::IUnknown { fn from(value: &IRTCBuddyEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCBuddyEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCBuddyEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCBuddyEvent> for super::Com::IDispatch { fn from(value: IRTCBuddyEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCBuddyEvent> for super::Com::IDispatch { fn from(value: &IRTCBuddyEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCBuddyEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCBuddyEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCBuddyEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppbuddy: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCBuddyEvent2(pub ::windows::core::IUnknown); impl IRTCBuddyEvent2 { pub unsafe fn GetTypeInfoCount(&self) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_System_Com")] pub unsafe fn GetTypeInfo(&self, itinfo: u32, lcid: u32) -> ::windows::core::Result<super::Com::ITypeInfo> { let mut result__: <super::Com::ITypeInfo as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(itinfo), ::core::mem::transmute(lcid), &mut result__).from_abi::<super::Com::ITypeInfo>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetIDsOfNames(&self, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(rgsznames), ::core::mem::transmute(cnames), ::core::mem::transmute(lcid), ::core::mem::transmute(rgdispid)).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Invoke(&self, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut super::Com::VARIANT, pexcepinfo: *mut super::Com::EXCEPINFO, puargerr: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)( ::core::mem::transmute_copy(self), ::core::mem::transmute(dispidmember), ::core::mem::transmute(riid), ::core::mem::transmute(lcid), ::core::mem::transmute(wflags), ::core::mem::transmute(pdispparams), ::core::mem::transmute(pvarresult), ::core::mem::transmute(pexcepinfo), ::core::mem::transmute(puargerr), ) .ok() } pub unsafe fn Buddy(&self) -> ::windows::core::Result<IRTCBuddy> { let mut result__: <IRTCBuddy as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCBuddy>(result__) } pub unsafe fn EventType(&self) -> ::windows::core::Result<RTC_BUDDY_EVENT_TYPE> { let mut result__: <RTC_BUDDY_EVENT_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_BUDDY_EVENT_TYPE>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCBuddyEvent2 { type Vtable = IRTCBuddyEvent2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x484a7f1e_73f0_4990_bfc2_60bc3978a720); } impl ::core::convert::From<IRTCBuddyEvent2> for ::windows::core::IUnknown { fn from(value: IRTCBuddyEvent2) -> Self { value.0 } } impl ::core::convert::From<&IRTCBuddyEvent2> for ::windows::core::IUnknown { fn from(value: &IRTCBuddyEvent2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCBuddyEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCBuddyEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCBuddyEvent2> for IRTCBuddyEvent { fn from(value: IRTCBuddyEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCBuddyEvent2> for IRTCBuddyEvent { fn from(value: &IRTCBuddyEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCBuddyEvent> for IRTCBuddyEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCBuddyEvent> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCBuddyEvent> for &IRTCBuddyEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCBuddyEvent> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCBuddyEvent2> for super::Com::IDispatch { fn from(value: IRTCBuddyEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCBuddyEvent2> for super::Com::IDispatch { fn from(value: &IRTCBuddyEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCBuddyEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCBuddyEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCBuddyEvent2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppbuddy: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peventtype: *mut RTC_BUDDY_EVENT_TYPE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCBuddyGroup(pub ::windows::core::IUnknown); impl IRTCBuddyGroup { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrgroupname: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrgroupname.into_param().abi()).ok() } pub unsafe fn AddBuddy<'a, Param0: ::windows::core::IntoParam<'a, IRTCBuddy>>(&self, pbuddy: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pbuddy.into_param().abi()).ok() } pub unsafe fn RemoveBuddy<'a, Param0: ::windows::core::IntoParam<'a, IRTCBuddy>>(&self, pbuddy: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), pbuddy.into_param().abi()).ok() } pub unsafe fn EnumerateBuddies(&self) -> ::windows::core::Result<IRTCEnumBuddies> { let mut result__: <IRTCEnumBuddies as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumBuddies>(result__) } pub unsafe fn Buddies(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Data(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdata: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), bstrdata.into_param().abi()).ok() } pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile2> { let mut result__: <IRTCProfile2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile2>(result__) } } unsafe impl ::windows::core::Interface for IRTCBuddyGroup { type Vtable = IRTCBuddyGroup_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x60361e68_9164_4389_a4c6_d0b3925bda5e); } impl ::core::convert::From<IRTCBuddyGroup> for ::windows::core::IUnknown { fn from(value: IRTCBuddyGroup) -> Self { value.0 } } impl ::core::convert::From<&IRTCBuddyGroup> for ::windows::core::IUnknown { fn from(value: &IRTCBuddyGroup) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCBuddyGroup { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCBuddyGroup { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCBuddyGroup_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrgroupname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrgroupname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbuddy: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbuddy: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCBuddyGroupEvent(pub ::windows::core::IUnknown); impl IRTCBuddyGroupEvent { pub unsafe fn EventType(&self) -> ::windows::core::Result<RTC_GROUP_EVENT_TYPE> { let mut result__: <RTC_GROUP_EVENT_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_GROUP_EVENT_TYPE>(result__) } pub unsafe fn Group(&self) -> ::windows::core::Result<IRTCBuddyGroup> { let mut result__: <IRTCBuddyGroup as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCBuddyGroup>(result__) } pub unsafe fn Buddy(&self) -> ::windows::core::Result<IRTCBuddy2> { let mut result__: <IRTCBuddy2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCBuddy2>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } } unsafe impl ::windows::core::Interface for IRTCBuddyGroupEvent { type Vtable = IRTCBuddyGroupEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3a79e1d1_b736_4414_96f8_bbc7f08863e4); } impl ::core::convert::From<IRTCBuddyGroupEvent> for ::windows::core::IUnknown { fn from(value: IRTCBuddyGroupEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCBuddyGroupEvent> for ::windows::core::IUnknown { fn from(value: &IRTCBuddyGroupEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCBuddyGroupEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCBuddyGroupEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCBuddyGroupEvent> for super::Com::IDispatch { fn from(value: IRTCBuddyGroupEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCBuddyGroupEvent> for super::Com::IDispatch { fn from(value: &IRTCBuddyGroupEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCBuddyGroupEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCBuddyGroupEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCBuddyGroupEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peventtype: *mut RTC_GROUP_EVENT_TYPE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppgroup: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppbuddy: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCClient(pub ::windows::core::IUnknown); impl IRTCClient { pub unsafe fn Initialize(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Shutdown(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn PrepareForShutdown(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn SetEventFilter(&self, lfilter: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(lfilter)).ok() } pub unsafe fn EventFilter(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetPreferredMediaTypes(&self, lmediatypes: i32, fpersistent: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatypes), ::core::mem::transmute(fpersistent)).ok() } pub unsafe fn PreferredMediaTypes(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn MediaCapabilities(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CreateSession<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, entype: RTC_SESSION_TYPE, bstrlocalphoneuri: Param1, pprofile: Param2, lflags: i32) -> ::windows::core::Result<IRTCSession> { let mut result__: <IRTCSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(entype), bstrlocalphoneuri.into_param().abi(), pprofile.into_param().abi(), ::core::mem::transmute(lflags), &mut result__).from_abi::<IRTCSession>(result__) } pub unsafe fn SetListenForIncomingSessions(&self, enlisten: RTC_LISTEN_MODE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(enlisten)).ok() } pub unsafe fn ListenForIncomingSessions(&self) -> ::windows::core::Result<RTC_LISTEN_MODE> { let mut result__: <RTC_LISTEN_MODE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_LISTEN_MODE>(result__) } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn NetworkAddresses(&self, ftcp: i16, fexternal: i16) -> ::windows::core::Result<super::Com::VARIANT> { let mut result__: <super::Com::VARIANT as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(ftcp), ::core::mem::transmute(fexternal), &mut result__).from_abi::<super::Com::VARIANT>(result__) } pub unsafe fn SetVolume(&self, endevice: RTC_AUDIO_DEVICE, lvolume: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), ::core::mem::transmute(lvolume)).ok() } pub unsafe fn Volume(&self, endevice: RTC_AUDIO_DEVICE) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetAudioMuted(&self, endevice: RTC_AUDIO_DEVICE, fmuted: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), ::core::mem::transmute(fmuted)).ok() } pub unsafe fn AudioMuted(&self, endevice: RTC_AUDIO_DEVICE) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Media_DirectShow")] pub unsafe fn IVideoWindow(&self, endevice: RTC_VIDEO_DEVICE) -> ::windows::core::Result<super::super::Media::DirectShow::IVideoWindow> { let mut result__: <super::super::Media::DirectShow::IVideoWindow as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<super::super::Media::DirectShow::IVideoWindow>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPreferredAudioDevice<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, endevice: RTC_AUDIO_DEVICE, bstrdevicename: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), bstrdevicename.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn PreferredAudioDevice(&self, endevice: RTC_AUDIO_DEVICE) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn SetPreferredVolume(&self, endevice: RTC_AUDIO_DEVICE, lvolume: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), ::core::mem::transmute(lvolume)).ok() } pub unsafe fn PreferredVolume(&self, endevice: RTC_AUDIO_DEVICE) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetPreferredAEC(&self, benable: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), ::core::mem::transmute(benable)).ok() } pub unsafe fn PreferredAEC(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPreferredVideoDevice<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdevicename: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self), bstrdevicename.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn PreferredVideoDevice(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn ActiveMedia(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).28)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetMaxBitrate(&self, lmaxbitrate: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).29)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmaxbitrate)).ok() } pub unsafe fn MaxBitrate(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).30)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetTemporalSpatialTradeOff(&self, lvalue: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).31)(::core::mem::transmute_copy(self), ::core::mem::transmute(lvalue)).ok() } pub unsafe fn TemporalSpatialTradeOff(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).32)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn NetworkQuality(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).33)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn StartT120Applet(&self, enapplet: RTC_T120_APPLET) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).34)(::core::mem::transmute_copy(self), ::core::mem::transmute(enapplet)).ok() } pub unsafe fn StopT120Applets(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).35)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn IsT120AppletRunning(&self, enapplet: RTC_T120_APPLET) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).36)(::core::mem::transmute_copy(self), ::core::mem::transmute(enapplet), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn LocalUserURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).37)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLocalUserURI<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstruseruri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).38)(::core::mem::transmute_copy(self), bstruseruri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn LocalUserName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).39)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLocalUserName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrusername: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).40)(::core::mem::transmute_copy(self), bstrusername.into_param().abi()).ok() } pub unsafe fn PlayRing(&self, entype: RTC_RING_TYPE, bplay: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).41)(::core::mem::transmute_copy(self), ::core::mem::transmute(entype), ::core::mem::transmute(bplay)).ok() } pub unsafe fn SendDTMF(&self, endtmf: RTC_DTMF) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).42)(::core::mem::transmute_copy(self), ::core::mem::transmute(endtmf)).ok() } pub unsafe fn InvokeTuningWizard(&self, hwndparent: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).43)(::core::mem::transmute_copy(self), ::core::mem::transmute(hwndparent)).ok() } pub unsafe fn IsTuned(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).44)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } } unsafe impl ::windows::core::Interface for IRTCClient { type Vtable = IRTCClient_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x07829e45_9a34_408e_a011_bddf13487cd1); } impl ::core::convert::From<IRTCClient> for ::windows::core::IUnknown { fn from(value: IRTCClient) -> Self { value.0 } } impl ::core::convert::From<&IRTCClient> for ::windows::core::IUnknown { fn from(value: &IRTCClient) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCClient_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lfilter: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plfilter: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatypes: i32, fpersistent: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmediatypes: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmediatypes: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, entype: RTC_SESSION_TYPE, bstrlocalphoneuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pprofile: ::windows::core::RawPtr, lflags: i32, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enlisten: RTC_LISTEN_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penlisten: *mut RTC_LISTEN_MODE) -> ::windows::core::HRESULT, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ftcp: i16, fexternal: i16, pvaddresses: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, lvolume: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, plvolume: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, fmuted: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, pfmuted: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Media_DirectShow")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_VIDEO_DEVICE, ppivideowindow: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Media_DirectShow"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, bstrdevicename: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, pbstrdevicename: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, lvolume: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, plvolume: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, benable: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbenabled: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdevicename: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdevicename: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmediatype: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmaxbitrate: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmaxbitrate: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lvalue: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plvalue: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plnetworkquality: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enapplet: RTC_T120_APPLET) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enapplet: RTC_T120_APPLET, pfrunning: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstruseruri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrusername: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, entype: RTC_RING_TYPE, bplay: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endtmf: RTC_DTMF) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hwndparent: isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pftuned: *mut i16) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCClient2(pub ::windows::core::IUnknown); impl IRTCClient2 { pub unsafe fn Initialize(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Shutdown(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn PrepareForShutdown(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn SetEventFilter(&self, lfilter: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(lfilter)).ok() } pub unsafe fn EventFilter(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetPreferredMediaTypes(&self, lmediatypes: i32, fpersistent: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatypes), ::core::mem::transmute(fpersistent)).ok() } pub unsafe fn PreferredMediaTypes(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn MediaCapabilities(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CreateSession<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, entype: RTC_SESSION_TYPE, bstrlocalphoneuri: Param1, pprofile: Param2, lflags: i32) -> ::windows::core::Result<IRTCSession> { let mut result__: <IRTCSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(entype), bstrlocalphoneuri.into_param().abi(), pprofile.into_param().abi(), ::core::mem::transmute(lflags), &mut result__).from_abi::<IRTCSession>(result__) } pub unsafe fn SetListenForIncomingSessions(&self, enlisten: RTC_LISTEN_MODE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(enlisten)).ok() } pub unsafe fn ListenForIncomingSessions(&self) -> ::windows::core::Result<RTC_LISTEN_MODE> { let mut result__: <RTC_LISTEN_MODE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_LISTEN_MODE>(result__) } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn NetworkAddresses(&self, ftcp: i16, fexternal: i16) -> ::windows::core::Result<super::Com::VARIANT> { let mut result__: <super::Com::VARIANT as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(ftcp), ::core::mem::transmute(fexternal), &mut result__).from_abi::<super::Com::VARIANT>(result__) } pub unsafe fn SetVolume(&self, endevice: RTC_AUDIO_DEVICE, lvolume: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), ::core::mem::transmute(lvolume)).ok() } pub unsafe fn Volume(&self, endevice: RTC_AUDIO_DEVICE) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetAudioMuted(&self, endevice: RTC_AUDIO_DEVICE, fmuted: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), ::core::mem::transmute(fmuted)).ok() } pub unsafe fn AudioMuted(&self, endevice: RTC_AUDIO_DEVICE) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Media_DirectShow")] pub unsafe fn IVideoWindow(&self, endevice: RTC_VIDEO_DEVICE) -> ::windows::core::Result<super::super::Media::DirectShow::IVideoWindow> { let mut result__: <super::super::Media::DirectShow::IVideoWindow as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<super::super::Media::DirectShow::IVideoWindow>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPreferredAudioDevice<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, endevice: RTC_AUDIO_DEVICE, bstrdevicename: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), bstrdevicename.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn PreferredAudioDevice(&self, endevice: RTC_AUDIO_DEVICE) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn SetPreferredVolume(&self, endevice: RTC_AUDIO_DEVICE, lvolume: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), ::core::mem::transmute(lvolume)).ok() } pub unsafe fn PreferredVolume(&self, endevice: RTC_AUDIO_DEVICE) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), ::core::mem::transmute(endevice), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetPreferredAEC(&self, benable: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), ::core::mem::transmute(benable)).ok() } pub unsafe fn PreferredAEC(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPreferredVideoDevice<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdevicename: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self), bstrdevicename.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn PreferredVideoDevice(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn ActiveMedia(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).28)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetMaxBitrate(&self, lmaxbitrate: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).29)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmaxbitrate)).ok() } pub unsafe fn MaxBitrate(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).30)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetTemporalSpatialTradeOff(&self, lvalue: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).31)(::core::mem::transmute_copy(self), ::core::mem::transmute(lvalue)).ok() } pub unsafe fn TemporalSpatialTradeOff(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).32)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn NetworkQuality(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).33)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn StartT120Applet(&self, enapplet: RTC_T120_APPLET) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).34)(::core::mem::transmute_copy(self), ::core::mem::transmute(enapplet)).ok() } pub unsafe fn StopT120Applets(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).35)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn IsT120AppletRunning(&self, enapplet: RTC_T120_APPLET) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).36)(::core::mem::transmute_copy(self), ::core::mem::transmute(enapplet), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn LocalUserURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).37)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLocalUserURI<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstruseruri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).38)(::core::mem::transmute_copy(self), bstruseruri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn LocalUserName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).39)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLocalUserName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrusername: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).40)(::core::mem::transmute_copy(self), bstrusername.into_param().abi()).ok() } pub unsafe fn PlayRing(&self, entype: RTC_RING_TYPE, bplay: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).41)(::core::mem::transmute_copy(self), ::core::mem::transmute(entype), ::core::mem::transmute(bplay)).ok() } pub unsafe fn SendDTMF(&self, endtmf: RTC_DTMF) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).42)(::core::mem::transmute_copy(self), ::core::mem::transmute(endtmf)).ok() } pub unsafe fn InvokeTuningWizard(&self, hwndparent: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).43)(::core::mem::transmute_copy(self), ::core::mem::transmute(hwndparent)).ok() } pub unsafe fn IsTuned(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).44)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } pub unsafe fn SetAnswerMode(&self, entype: RTC_SESSION_TYPE, enmode: RTC_ANSWER_MODE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).45)(::core::mem::transmute_copy(self), ::core::mem::transmute(entype), ::core::mem::transmute(enmode)).ok() } pub unsafe fn AnswerMode(&self, entype: RTC_SESSION_TYPE) -> ::windows::core::Result<RTC_ANSWER_MODE> { let mut result__: <RTC_ANSWER_MODE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).46)(::core::mem::transmute_copy(self), ::core::mem::transmute(entype), &mut result__).from_abi::<RTC_ANSWER_MODE>(result__) } pub unsafe fn InvokeTuningWizardEx(&self, hwndparent: isize, fallowaudio: i16, fallowvideo: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).47)(::core::mem::transmute_copy(self), ::core::mem::transmute(hwndparent), ::core::mem::transmute(fallowaudio), ::core::mem::transmute(fallowvideo)).ok() } pub unsafe fn Version(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).48)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetClientName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrclientname: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).49)(::core::mem::transmute_copy(self), bstrclientname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetClientCurVer<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrclientcurver: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).50)(::core::mem::transmute_copy(self), bstrclientcurver.into_param().abi()).ok() } pub unsafe fn InitializeEx(&self, lflags: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).51)(::core::mem::transmute_copy(self), ::core::mem::transmute(lflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CreateSessionWithDescription<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, bstrcontenttype: Param0, bstrsessiondescription: Param1, pprofile: Param2, lflags: i32) -> ::windows::core::Result<IRTCSession2> { let mut result__: <IRTCSession2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).52)(::core::mem::transmute_copy(self), bstrcontenttype.into_param().abi(), bstrsessiondescription.into_param().abi(), pprofile.into_param().abi(), ::core::mem::transmute(lflags), &mut result__).from_abi::<IRTCSession2>(result__) } pub unsafe fn SetSessionDescriptionManager<'a, Param0: ::windows::core::IntoParam<'a, IRTCSessionDescriptionManager>>(&self, psessiondescriptionmanager: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).53)(::core::mem::transmute_copy(self), psessiondescriptionmanager.into_param().abi()).ok() } pub unsafe fn SetPreferredSecurityLevel(&self, ensecuritytype: RTC_SECURITY_TYPE, ensecuritylevel: RTC_SECURITY_LEVEL) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).54)(::core::mem::transmute_copy(self), ::core::mem::transmute(ensecuritytype), ::core::mem::transmute(ensecuritylevel)).ok() } pub unsafe fn PreferredSecurityLevel(&self, ensecuritytype: RTC_SECURITY_TYPE) -> ::windows::core::Result<RTC_SECURITY_LEVEL> { let mut result__: <RTC_SECURITY_LEVEL as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).55)(::core::mem::transmute_copy(self), ::core::mem::transmute(ensecuritytype), &mut result__).from_abi::<RTC_SECURITY_LEVEL>(result__) } pub unsafe fn SetAllowedPorts(&self, ltransport: i32, enlistenmode: RTC_LISTEN_MODE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).56)(::core::mem::transmute_copy(self), ::core::mem::transmute(ltransport), ::core::mem::transmute(enlistenmode)).ok() } pub unsafe fn AllowedPorts(&self, ltransport: i32) -> ::windows::core::Result<RTC_LISTEN_MODE> { let mut result__: <RTC_LISTEN_MODE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).57)(::core::mem::transmute_copy(self), ::core::mem::transmute(ltransport), &mut result__).from_abi::<RTC_LISTEN_MODE>(result__) } } unsafe impl ::windows::core::Interface for IRTCClient2 { type Vtable = IRTCClient2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0c91d71d_1064_42da_bfa5_572beb8eea84); } impl ::core::convert::From<IRTCClient2> for ::windows::core::IUnknown { fn from(value: IRTCClient2) -> Self { value.0 } } impl ::core::convert::From<&IRTCClient2> for ::windows::core::IUnknown { fn from(value: &IRTCClient2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCClient2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCClient2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCClient2> for IRTCClient { fn from(value: IRTCClient2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCClient2> for IRTCClient { fn from(value: &IRTCClient2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCClient> for IRTCClient2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCClient> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCClient> for &IRTCClient2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCClient> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCClient2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lfilter: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plfilter: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatypes: i32, fpersistent: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmediatypes: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmediatypes: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, entype: RTC_SESSION_TYPE, bstrlocalphoneuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pprofile: ::windows::core::RawPtr, lflags: i32, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enlisten: RTC_LISTEN_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penlisten: *mut RTC_LISTEN_MODE) -> ::windows::core::HRESULT, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ftcp: i16, fexternal: i16, pvaddresses: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, lvolume: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, plvolume: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, fmuted: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, pfmuted: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Media_DirectShow")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_VIDEO_DEVICE, ppivideowindow: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Media_DirectShow"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, bstrdevicename: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, pbstrdevicename: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, lvolume: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endevice: RTC_AUDIO_DEVICE, plvolume: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, benable: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbenabled: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdevicename: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdevicename: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmediatype: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmaxbitrate: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmaxbitrate: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lvalue: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plvalue: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plnetworkquality: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enapplet: RTC_T120_APPLET) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enapplet: RTC_T120_APPLET, pfrunning: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstruseruri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrusername: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, entype: RTC_RING_TYPE, bplay: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, endtmf: RTC_DTMF) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hwndparent: isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pftuned: *mut i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, entype: RTC_SESSION_TYPE, enmode: RTC_ANSWER_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, entype: RTC_SESSION_TYPE, penmode: *mut RTC_ANSWER_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hwndparent: isize, fallowaudio: i16, fallowvideo: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plversion: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrclientname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrclientcurver: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lflags: i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrcontenttype: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrsessiondescription: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pprofile: ::windows::core::RawPtr, lflags: i32, ppsession2: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psessiondescriptionmanager: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ensecuritytype: RTC_SECURITY_TYPE, ensecuritylevel: RTC_SECURITY_LEVEL) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ensecuritytype: RTC_SECURITY_TYPE, pensecuritylevel: *mut RTC_SECURITY_LEVEL) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ltransport: i32, enlistenmode: RTC_LISTEN_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ltransport: i32, penlistenmode: *mut RTC_LISTEN_MODE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCClientEvent(pub ::windows::core::IUnknown); impl IRTCClientEvent { pub unsafe fn EventType(&self) -> ::windows::core::Result<RTC_CLIENT_EVENT_TYPE> { let mut result__: <RTC_CLIENT_EVENT_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_CLIENT_EVENT_TYPE>(result__) } pub unsafe fn Client(&self) -> ::windows::core::Result<IRTCClient> { let mut result__: <IRTCClient as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCClient>(result__) } } unsafe impl ::windows::core::Interface for IRTCClientEvent { type Vtable = IRTCClientEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2b493b7a_3cba_4170_9c8b_76a9dacdd644); } impl ::core::convert::From<IRTCClientEvent> for ::windows::core::IUnknown { fn from(value: IRTCClientEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCClientEvent> for ::windows::core::IUnknown { fn from(value: &IRTCClientEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCClientEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCClientEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCClientEvent> for super::Com::IDispatch { fn from(value: IRTCClientEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCClientEvent> for super::Com::IDispatch { fn from(value: &IRTCClientEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCClientEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCClientEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCClientEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peneventtype: *mut RTC_CLIENT_EVENT_TYPE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppclient: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCClientPortManagement(pub ::windows::core::IUnknown); impl IRTCClientPortManagement { #[cfg(feature = "Win32_Foundation")] pub unsafe fn StartListenAddressAndPort<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrinternallocaladdress: Param0, linternallocalport: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), bstrinternallocaladdress.into_param().abi(), ::core::mem::transmute(linternallocalport)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StopListenAddressAndPort<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrinternallocaladdress: Param0, linternallocalport: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrinternallocaladdress.into_param().abi(), ::core::mem::transmute(linternallocalport)).ok() } pub unsafe fn GetPortRange(&self, enporttype: RTC_PORT_TYPE, plminvalue: *mut i32, plmaxvalue: *mut i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(enporttype), ::core::mem::transmute(plminvalue), ::core::mem::transmute(plmaxvalue)).ok() } } unsafe impl ::windows::core::Interface for IRTCClientPortManagement { type Vtable = IRTCClientPortManagement_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd5df3f03_4bde_4417_aefe_71177bdaea66); } impl ::core::convert::From<IRTCClientPortManagement> for ::windows::core::IUnknown { fn from(value: IRTCClientPortManagement) -> Self { value.0 } } impl ::core::convert::From<&IRTCClientPortManagement> for ::windows::core::IUnknown { fn from(value: &IRTCClientPortManagement) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCClientPortManagement { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCClientPortManagement { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCClientPortManagement_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrinternallocaladdress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, linternallocalport: i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrinternallocaladdress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, linternallocalport: i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enporttype: RTC_PORT_TYPE, plminvalue: *mut i32, plmaxvalue: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCClientPresence(pub ::windows::core::IUnknown); impl IRTCClientPresence { #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn EnablePresence<'a, Param1: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, fusestorage: i16, varstorage: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(fusestorage), varstorage.into_param().abi()).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Export<'a, Param0: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, varstorage: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), varstorage.into_param().abi()).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Import<'a, Param0: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, varstorage: Param0, freplaceall: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), varstorage.into_param().abi(), ::core::mem::transmute(freplaceall)).ok() } pub unsafe fn EnumerateBuddies(&self) -> ::windows::core::Result<IRTCEnumBuddies> { let mut result__: <IRTCEnumBuddies as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumBuddies>(result__) } pub unsafe fn Buddies(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Buddy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<IRTCBuddy> { let mut result__: <IRTCBuddy as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), &mut result__).from_abi::<IRTCBuddy>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddBuddy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, bstrpresentityuri: Param0, bstrusername: Param1, bstrdata: Param2, fpersistent: i16, pprofile: Param4, lflags: i32) -> ::windows::core::Result<IRTCBuddy> { let mut result__: <IRTCBuddy as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), bstrusername.into_param().abi(), bstrdata.into_param().abi(), ::core::mem::transmute(fpersistent), pprofile.into_param().abi(), ::core::mem::transmute(lflags), &mut result__).from_abi::<IRTCBuddy>(result__) } pub unsafe fn RemoveBuddy<'a, Param0: ::windows::core::IntoParam<'a, IRTCBuddy>>(&self, pbuddy: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), pbuddy.into_param().abi()).ok() } pub unsafe fn EnumerateWatchers(&self) -> ::windows::core::Result<IRTCEnumWatchers> { let mut result__: <IRTCEnumWatchers as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumWatchers>(result__) } pub unsafe fn Watchers(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Watcher<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<IRTCWatcher> { let mut result__: <IRTCWatcher as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), &mut result__).from_abi::<IRTCWatcher>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddWatcher<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0, bstrusername: Param1, bstrdata: Param2, fblocked: i16, fpersistent: i16) -> ::windows::core::Result<IRTCWatcher> { let mut result__: <IRTCWatcher as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), bstrusername.into_param().abi(), bstrdata.into_param().abi(), ::core::mem::transmute(fblocked), ::core::mem::transmute(fpersistent), &mut result__).from_abi::<IRTCWatcher>(result__) } pub unsafe fn RemoveWatcher<'a, Param0: ::windows::core::IntoParam<'a, IRTCWatcher>>(&self, pwatcher: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), pwatcher.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLocalPresenceInfo<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, enstatus: RTC_PRESENCE_STATUS, bstrnotes: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(enstatus), bstrnotes.into_param().abi()).ok() } pub unsafe fn OfferWatcherMode(&self) -> ::windows::core::Result<RTC_OFFER_WATCHER_MODE> { let mut result__: <RTC_OFFER_WATCHER_MODE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_OFFER_WATCHER_MODE>(result__) } pub unsafe fn SetOfferWatcherMode(&self, enmode: RTC_OFFER_WATCHER_MODE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(enmode)).ok() } pub unsafe fn PrivacyMode(&self) -> ::windows::core::Result<RTC_PRIVACY_MODE> { let mut result__: <RTC_PRIVACY_MODE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PRIVACY_MODE>(result__) } pub unsafe fn SetPrivacyMode(&self, enmode: RTC_PRIVACY_MODE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), ::core::mem::transmute(enmode)).ok() } } unsafe impl ::windows::core::Interface for IRTCClientPresence { type Vtable = IRTCClientPresence_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x11c3cbcc_0744_42d1_968a_51aa1bb274c6); } impl ::core::convert::From<IRTCClientPresence> for ::windows::core::IUnknown { fn from(value: IRTCClientPresence) -> Self { value.0 } } impl ::core::convert::From<&IRTCClientPresence> for ::windows::core::IUnknown { fn from(value: &IRTCClientPresence) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCClientPresence { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCClientPresence { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCClientPresence_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fusestorage: i16, varstorage: ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, varstorage: ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, varstorage: ::core::mem::ManuallyDrop<super::Com::VARIANT>, freplaceall: i16) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppbuddy: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, fpersistent: i16, pprofile: ::windows::core::RawPtr, lflags: i32, ppbuddy: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbuddy: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppwatcher: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, fblocked: i16, fpersistent: i16, ppwatcher: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwatcher: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enstatus: RTC_PRESENCE_STATUS, bstrnotes: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penmode: *mut RTC_OFFER_WATCHER_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enmode: RTC_OFFER_WATCHER_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penmode: *mut RTC_PRIVACY_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enmode: RTC_PRIVACY_MODE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCClientPresence2(pub ::windows::core::IUnknown); impl IRTCClientPresence2 { #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn EnablePresence<'a, Param1: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, fusestorage: i16, varstorage: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(fusestorage), varstorage.into_param().abi()).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Export<'a, Param0: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, varstorage: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), varstorage.into_param().abi()).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Import<'a, Param0: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, varstorage: Param0, freplaceall: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), varstorage.into_param().abi(), ::core::mem::transmute(freplaceall)).ok() } pub unsafe fn EnumerateBuddies(&self) -> ::windows::core::Result<IRTCEnumBuddies> { let mut result__: <IRTCEnumBuddies as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumBuddies>(result__) } pub unsafe fn Buddies(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Buddy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<IRTCBuddy> { let mut result__: <IRTCBuddy as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), &mut result__).from_abi::<IRTCBuddy>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddBuddy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, bstrpresentityuri: Param0, bstrusername: Param1, bstrdata: Param2, fpersistent: i16, pprofile: Param4, lflags: i32) -> ::windows::core::Result<IRTCBuddy> { let mut result__: <IRTCBuddy as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), bstrusername.into_param().abi(), bstrdata.into_param().abi(), ::core::mem::transmute(fpersistent), pprofile.into_param().abi(), ::core::mem::transmute(lflags), &mut result__).from_abi::<IRTCBuddy>(result__) } pub unsafe fn RemoveBuddy<'a, Param0: ::windows::core::IntoParam<'a, IRTCBuddy>>(&self, pbuddy: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), pbuddy.into_param().abi()).ok() } pub unsafe fn EnumerateWatchers(&self) -> ::windows::core::Result<IRTCEnumWatchers> { let mut result__: <IRTCEnumWatchers as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumWatchers>(result__) } pub unsafe fn Watchers(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Watcher<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<IRTCWatcher> { let mut result__: <IRTCWatcher as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), &mut result__).from_abi::<IRTCWatcher>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddWatcher<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0, bstrusername: Param1, bstrdata: Param2, fblocked: i16, fpersistent: i16) -> ::windows::core::Result<IRTCWatcher> { let mut result__: <IRTCWatcher as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), bstrusername.into_param().abi(), bstrdata.into_param().abi(), ::core::mem::transmute(fblocked), ::core::mem::transmute(fpersistent), &mut result__).from_abi::<IRTCWatcher>(result__) } pub unsafe fn RemoveWatcher<'a, Param0: ::windows::core::IntoParam<'a, IRTCWatcher>>(&self, pwatcher: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), pwatcher.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLocalPresenceInfo<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, enstatus: RTC_PRESENCE_STATUS, bstrnotes: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(enstatus), bstrnotes.into_param().abi()).ok() } pub unsafe fn OfferWatcherMode(&self) -> ::windows::core::Result<RTC_OFFER_WATCHER_MODE> { let mut result__: <RTC_OFFER_WATCHER_MODE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_OFFER_WATCHER_MODE>(result__) } pub unsafe fn SetOfferWatcherMode(&self, enmode: RTC_OFFER_WATCHER_MODE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(enmode)).ok() } pub unsafe fn PrivacyMode(&self) -> ::windows::core::Result<RTC_PRIVACY_MODE> { let mut result__: <RTC_PRIVACY_MODE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PRIVACY_MODE>(result__) } pub unsafe fn SetPrivacyMode(&self, enmode: RTC_PRIVACY_MODE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), ::core::mem::transmute(enmode)).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn EnablePresenceEx<'a, Param0: ::windows::core::IntoParam<'a, IRTCProfile>, Param1: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, pprofile: Param0, varstorage: Param1, lflags: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), pprofile.into_param().abi(), varstorage.into_param().abi(), ::core::mem::transmute(lflags)).ok() } pub unsafe fn DisablePresence(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddGroup<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, bstrgroupname: Param0, bstrdata: Param1, pprofile: Param2, lflags: i32) -> ::windows::core::Result<IRTCBuddyGroup> { let mut result__: <IRTCBuddyGroup as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), bstrgroupname.into_param().abi(), bstrdata.into_param().abi(), pprofile.into_param().abi(), ::core::mem::transmute(lflags), &mut result__).from_abi::<IRTCBuddyGroup>(result__) } pub unsafe fn RemoveGroup<'a, Param0: ::windows::core::IntoParam<'a, IRTCBuddyGroup>>(&self, pgroup: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), pgroup.into_param().abi()).ok() } pub unsafe fn EnumerateGroups(&self) -> ::windows::core::Result<IRTCEnumGroups> { let mut result__: <IRTCEnumGroups as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumGroups>(result__) } pub unsafe fn Groups(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Group<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrgroupname: Param0) -> ::windows::core::Result<IRTCBuddyGroup> { let mut result__: <IRTCBuddyGroup as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self), bstrgroupname.into_param().abi(), &mut result__).from_abi::<IRTCBuddyGroup>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddWatcherEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param6: ::windows::core::IntoParam<'a, IRTCProfile>>( &self, bstrpresentityuri: Param0, bstrusername: Param1, bstrdata: Param2, enstate: RTC_WATCHER_STATE, fpersistent: i16, enscope: RTC_ACE_SCOPE, pprofile: Param6, lflags: i32, ) -> ::windows::core::Result<IRTCWatcher2> { let mut result__: <IRTCWatcher2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).28)( ::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), bstrusername.into_param().abi(), bstrdata.into_param().abi(), ::core::mem::transmute(enstate), ::core::mem::transmute(fpersistent), ::core::mem::transmute(enscope), pprofile.into_param().abi(), ::core::mem::transmute(lflags), &mut result__, ) .from_abi::<IRTCWatcher2>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn WatcherEx<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, enmode: RTC_WATCHER_MATCH_MODE, bstrpresentityuri: Param1) -> ::windows::core::Result<IRTCWatcher2> { let mut result__: <IRTCWatcher2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).29)(::core::mem::transmute_copy(self), ::core::mem::transmute(enmode), bstrpresentityuri.into_param().abi(), &mut result__).from_abi::<IRTCWatcher2>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPresenceProperty<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, enproperty: RTC_PRESENCE_PROPERTY, bstrproperty: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).30)(::core::mem::transmute_copy(self), ::core::mem::transmute(enproperty), bstrproperty.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn PresenceProperty(&self, enproperty: RTC_PRESENCE_PROPERTY) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).31)(::core::mem::transmute_copy(self), ::core::mem::transmute(enproperty), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPresenceData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrnamespace: Param0, bstrdata: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).32)(::core::mem::transmute_copy(self), bstrnamespace.into_param().abi(), bstrdata.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetPresenceData(&self, pbstrnamespace: *mut super::super::Foundation::BSTR, pbstrdata: *mut super::super::Foundation::BSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).33)(::core::mem::transmute_copy(self), ::core::mem::transmute(pbstrnamespace), ::core::mem::transmute(pbstrdata)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetLocalPresenceInfo(&self, penstatus: *mut RTC_PRESENCE_STATUS, pbstrnotes: *mut super::super::Foundation::BSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).34)(::core::mem::transmute_copy(self), ::core::mem::transmute(penstatus), ::core::mem::transmute(pbstrnotes)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddBuddyEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param5: ::windows::core::IntoParam<'a, IRTCProfile>>( &self, bstrpresentityuri: Param0, bstrusername: Param1, bstrdata: Param2, fpersistent: i16, ensubscriptiontype: RTC_BUDDY_SUBSCRIPTION_TYPE, pprofile: Param5, lflags: i32, ) -> ::windows::core::Result<IRTCBuddy2> { let mut result__: <IRTCBuddy2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).35)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi(), bstrusername.into_param().abi(), bstrdata.into_param().abi(), ::core::mem::transmute(fpersistent), ::core::mem::transmute(ensubscriptiontype), pprofile.into_param().abi(), ::core::mem::transmute(lflags), &mut result__).from_abi::<IRTCBuddy2>(result__) } } unsafe impl ::windows::core::Interface for IRTCClientPresence2 { type Vtable = IRTCClientPresence2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xad1809e8_62f7_4783_909a_29c9d2cb1d34); } impl ::core::convert::From<IRTCClientPresence2> for ::windows::core::IUnknown { fn from(value: IRTCClientPresence2) -> Self { value.0 } } impl ::core::convert::From<&IRTCClientPresence2> for ::windows::core::IUnknown { fn from(value: &IRTCClientPresence2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCClientPresence2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCClientPresence2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCClientPresence2> for IRTCClientPresence { fn from(value: IRTCClientPresence2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCClientPresence2> for IRTCClientPresence { fn from(value: &IRTCClientPresence2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCClientPresence> for IRTCClientPresence2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCClientPresence> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCClientPresence> for &IRTCClientPresence2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCClientPresence> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCClientPresence2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fusestorage: i16, varstorage: ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, varstorage: ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, varstorage: ::core::mem::ManuallyDrop<super::Com::VARIANT>, freplaceall: i16) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppbuddy: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, fpersistent: i16, pprofile: ::windows::core::RawPtr, lflags: i32, ppbuddy: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbuddy: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppwatcher: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, fblocked: i16, fpersistent: i16, ppwatcher: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwatcher: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enstatus: RTC_PRESENCE_STATUS, bstrnotes: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penmode: *mut RTC_OFFER_WATCHER_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enmode: RTC_OFFER_WATCHER_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penmode: *mut RTC_PRIVACY_MODE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enmode: RTC_PRIVACY_MODE) -> ::windows::core::HRESULT, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprofile: ::windows::core::RawPtr, varstorage: ::core::mem::ManuallyDrop<super::Com::VARIANT>, lflags: i32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrgroupname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pprofile: ::windows::core::RawPtr, lflags: i32, ppgroup: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pgroup: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrgroupname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppgroup: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, enstate: RTC_WATCHER_STATE, fpersistent: i16, enscope: RTC_ACE_SCOPE, pprofile: ::windows::core::RawPtr, lflags: i32, ppwatcher: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enmode: RTC_WATCHER_MATCH_MODE, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppwatcher: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enproperty: RTC_PRESENCE_PROPERTY, bstrproperty: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enproperty: RTC_PRESENCE_PROPERTY, pbstrproperty: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrnamespace: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrnamespace: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstatus: *mut RTC_PRESENCE_STATUS, pbstrnotes: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, fpersistent: i16, ensubscriptiontype: RTC_BUDDY_SUBSCRIPTION_TYPE, pprofile: ::windows::core::RawPtr, lflags: i32, ppbuddy: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCClientProvisioning(pub ::windows::core::IUnknown); impl IRTCClientProvisioning { #[cfg(feature = "Win32_Foundation")] pub unsafe fn CreateProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrprofilexml: Param0) -> ::windows::core::Result<IRTCProfile> { let mut result__: <IRTCProfile as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), bstrprofilexml.into_param().abi(), &mut result__).from_abi::<IRTCProfile>(result__) } pub unsafe fn EnableProfile<'a, Param0: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, pprofile: Param0, lregisterflags: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pprofile.into_param().abi(), ::core::mem::transmute(lregisterflags)).ok() } pub unsafe fn DisableProfile<'a, Param0: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, pprofile: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pprofile.into_param().abi()).ok() } pub unsafe fn EnumerateProfiles(&self) -> ::windows::core::Result<IRTCEnumProfiles> { let mut result__: <IRTCEnumProfiles as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumProfiles>(result__) } pub unsafe fn Profiles(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstruseraccount: Param0, bstruserpassword: Param1, bstruseruri: Param2, bstrserver: Param3, ltransport: i32, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstruseraccount.into_param().abi(), bstruserpassword.into_param().abi(), bstruseruri.into_param().abi(), bstrserver.into_param().abi(), ::core::mem::transmute(ltransport), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn SessionCapabilities(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } } unsafe impl ::windows::core::Interface for IRTCClientProvisioning { type Vtable = IRTCClientProvisioning_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb9f5cf06_65b9_4a80_a0e6_73cae3ef3822); } impl ::core::convert::From<IRTCClientProvisioning> for ::windows::core::IUnknown { fn from(value: IRTCClientProvisioning) -> Self { value.0 } } impl ::core::convert::From<&IRTCClientProvisioning> for ::windows::core::IUnknown { fn from(value: &IRTCClientProvisioning) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCClientProvisioning { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCClientProvisioning { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCClientProvisioning_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrprofilexml: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprofile: ::windows::core::RawPtr, lregisterflags: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprofile: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstruseraccount: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstruserpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstruseruri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrserver: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ltransport: i32, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plsupportedsessions: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCClientProvisioning2(pub ::windows::core::IUnknown); impl IRTCClientProvisioning2 { #[cfg(feature = "Win32_Foundation")] pub unsafe fn CreateProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrprofilexml: Param0) -> ::windows::core::Result<IRTCProfile> { let mut result__: <IRTCProfile as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), bstrprofilexml.into_param().abi(), &mut result__).from_abi::<IRTCProfile>(result__) } pub unsafe fn EnableProfile<'a, Param0: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, pprofile: Param0, lregisterflags: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pprofile.into_param().abi(), ::core::mem::transmute(lregisterflags)).ok() } pub unsafe fn DisableProfile<'a, Param0: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, pprofile: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pprofile.into_param().abi()).ok() } pub unsafe fn EnumerateProfiles(&self) -> ::windows::core::Result<IRTCEnumProfiles> { let mut result__: <IRTCEnumProfiles as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumProfiles>(result__) } pub unsafe fn Profiles(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstruseraccount: Param0, bstruserpassword: Param1, bstruseruri: Param2, bstrserver: Param3, ltransport: i32, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstruseraccount.into_param().abi(), bstruserpassword.into_param().abi(), bstruseruri.into_param().abi(), bstrserver.into_param().abi(), ::core::mem::transmute(ltransport), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn SessionCapabilities(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn EnableProfileEx<'a, Param0: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, pprofile: Param0, lregisterflags: i32, lroamingflags: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), pprofile.into_param().abi(), ::core::mem::transmute(lregisterflags), ::core::mem::transmute(lroamingflags)).ok() } } unsafe impl ::windows::core::Interface for IRTCClientProvisioning2 { type Vtable = IRTCClientProvisioning2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa70909b5_f40e_4587_bb75_e6bc0845023e); } impl ::core::convert::From<IRTCClientProvisioning2> for ::windows::core::IUnknown { fn from(value: IRTCClientProvisioning2) -> Self { value.0 } } impl ::core::convert::From<&IRTCClientProvisioning2> for ::windows::core::IUnknown { fn from(value: &IRTCClientProvisioning2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCClientProvisioning2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCClientProvisioning2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCClientProvisioning2> for IRTCClientProvisioning { fn from(value: IRTCClientProvisioning2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCClientProvisioning2> for IRTCClientProvisioning { fn from(value: &IRTCClientProvisioning2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCClientProvisioning> for IRTCClientProvisioning2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCClientProvisioning> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCClientProvisioning> for &IRTCClientProvisioning2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCClientProvisioning> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCClientProvisioning2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrprofilexml: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprofile: ::windows::core::RawPtr, lregisterflags: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprofile: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstruseraccount: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstruserpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstruseruri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrserver: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ltransport: i32, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plsupportedsessions: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprofile: ::windows::core::RawPtr, lregisterflags: i32, lroamingflags: i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCCollection(pub ::windows::core::IUnknown); impl IRTCCollection { pub unsafe fn Count(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Item(&self, index: i32) -> ::windows::core::Result<super::Com::VARIANT> { let mut result__: <super::Com::VARIANT as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(index), &mut result__).from_abi::<super::Com::VARIANT>(result__) } pub unsafe fn _NewEnum(&self) -> ::windows::core::Result<::windows::core::IUnknown> { let mut result__: <::windows::core::IUnknown as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<::windows::core::IUnknown>(result__) } } unsafe impl ::windows::core::Interface for IRTCCollection { type Vtable = IRTCCollection_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xec7c8096_b918_4044_94f1_e4fba0361d5c); } impl ::core::convert::From<IRTCCollection> for ::windows::core::IUnknown { fn from(value: IRTCCollection) -> Self { value.0 } } impl ::core::convert::From<&IRTCCollection> for ::windows::core::IUnknown { fn from(value: &IRTCCollection) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCCollection { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCCollection { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCCollection> for super::Com::IDispatch { fn from(value: IRTCCollection) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCCollection> for super::Com::IDispatch { fn from(value: &IRTCCollection) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCCollection { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCCollection { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCCollection_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lcount: *mut i32) -> ::windows::core::HRESULT, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, index: i32, pvariant: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppnewenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCDispatchEventNotification(pub ::windows::core::IUnknown); impl IRTCDispatchEventNotification {} unsafe impl ::windows::core::Interface for IRTCDispatchEventNotification { type Vtable = IRTCDispatchEventNotification_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x176ddfbe_fec0_4d55_bc87_84cff1ef7f91); } impl ::core::convert::From<IRTCDispatchEventNotification> for ::windows::core::IUnknown { fn from(value: IRTCDispatchEventNotification) -> Self { value.0 } } impl ::core::convert::From<&IRTCDispatchEventNotification> for ::windows::core::IUnknown { fn from(value: &IRTCDispatchEventNotification) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCDispatchEventNotification { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCDispatchEventNotification { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCDispatchEventNotification> for super::Com::IDispatch { fn from(value: IRTCDispatchEventNotification) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCDispatchEventNotification> for super::Com::IDispatch { fn from(value: &IRTCDispatchEventNotification) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCDispatchEventNotification { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCDispatchEventNotification { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCDispatchEventNotification_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCEnumBuddies(pub ::windows::core::IUnknown); impl IRTCEnumBuddies { pub unsafe fn Next(&self, celt: u32, ppelements: *mut ::core::option::Option<IRTCBuddy>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(ppelements), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IRTCEnumBuddies> { let mut result__: <IRTCEnumBuddies as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumBuddies>(result__) } } unsafe impl ::windows::core::Interface for IRTCEnumBuddies { type Vtable = IRTCEnumBuddies_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf7296917_5569_4b3b_b3af_98d1144b2b87); } impl ::core::convert::From<IRTCEnumBuddies> for ::windows::core::IUnknown { fn from(value: IRTCEnumBuddies) -> Self { value.0 } } impl ::core::convert::From<&IRTCEnumBuddies> for ::windows::core::IUnknown { fn from(value: &IRTCEnumBuddies) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCEnumBuddies { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCEnumBuddies { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCEnumBuddies_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32, ppelements: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCEnumGroups(pub ::windows::core::IUnknown); impl IRTCEnumGroups { pub unsafe fn Next(&self, celt: u32, ppelements: *mut ::core::option::Option<IRTCBuddyGroup>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(ppelements), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IRTCEnumGroups> { let mut result__: <IRTCEnumGroups as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumGroups>(result__) } } unsafe impl ::windows::core::Interface for IRTCEnumGroups { type Vtable = IRTCEnumGroups_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x742378d6_a141_4415_8f27_35d99076cf5d); } impl ::core::convert::From<IRTCEnumGroups> for ::windows::core::IUnknown { fn from(value: IRTCEnumGroups) -> Self { value.0 } } impl ::core::convert::From<&IRTCEnumGroups> for ::windows::core::IUnknown { fn from(value: &IRTCEnumGroups) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCEnumGroups { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCEnumGroups { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCEnumGroups_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32, ppelements: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCEnumParticipants(pub ::windows::core::IUnknown); impl IRTCEnumParticipants { pub unsafe fn Next(&self, celt: u32, ppelements: *mut ::core::option::Option<IRTCParticipant>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(ppelements), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IRTCEnumParticipants> { let mut result__: <IRTCEnumParticipants as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumParticipants>(result__) } } unsafe impl ::windows::core::Interface for IRTCEnumParticipants { type Vtable = IRTCEnumParticipants_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfcd56f29_4a4f_41b2_ba5c_f5bccc060bf6); } impl ::core::convert::From<IRTCEnumParticipants> for ::windows::core::IUnknown { fn from(value: IRTCEnumParticipants) -> Self { value.0 } } impl ::core::convert::From<&IRTCEnumParticipants> for ::windows::core::IUnknown { fn from(value: &IRTCEnumParticipants) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCEnumParticipants { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCEnumParticipants { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCEnumParticipants_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32, ppelements: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCEnumPresenceDevices(pub ::windows::core::IUnknown); impl IRTCEnumPresenceDevices { pub unsafe fn Next(&self, celt: u32, ppelements: *mut ::core::option::Option<IRTCPresenceDevice>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(ppelements), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IRTCEnumPresenceDevices> { let mut result__: <IRTCEnumPresenceDevices as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumPresenceDevices>(result__) } } unsafe impl ::windows::core::Interface for IRTCEnumPresenceDevices { type Vtable = IRTCEnumPresenceDevices_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x708c2ab7_8bf8_42f8_8c7d_635197ad5539); } impl ::core::convert::From<IRTCEnumPresenceDevices> for ::windows::core::IUnknown { fn from(value: IRTCEnumPresenceDevices) -> Self { value.0 } } impl ::core::convert::From<&IRTCEnumPresenceDevices> for ::windows::core::IUnknown { fn from(value: &IRTCEnumPresenceDevices) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCEnumPresenceDevices { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCEnumPresenceDevices { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCEnumPresenceDevices_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32, ppelements: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCEnumProfiles(pub ::windows::core::IUnknown); impl IRTCEnumProfiles { pub unsafe fn Next(&self, celt: u32, ppelements: *mut ::core::option::Option<IRTCProfile>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(ppelements), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IRTCEnumProfiles> { let mut result__: <IRTCEnumProfiles as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumProfiles>(result__) } } unsafe impl ::windows::core::Interface for IRTCEnumProfiles { type Vtable = IRTCEnumProfiles_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x29b7c41c_ed82_4bca_84ad_39d5101b58e3); } impl ::core::convert::From<IRTCEnumProfiles> for ::windows::core::IUnknown { fn from(value: IRTCEnumProfiles) -> Self { value.0 } } impl ::core::convert::From<&IRTCEnumProfiles> for ::windows::core::IUnknown { fn from(value: &IRTCEnumProfiles) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCEnumProfiles { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCEnumProfiles { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCEnumProfiles_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32, ppelements: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCEnumUserSearchResults(pub ::windows::core::IUnknown); impl IRTCEnumUserSearchResults { pub unsafe fn Next(&self, celt: u32, ppelements: *mut ::core::option::Option<IRTCUserSearchResult>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(ppelements), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IRTCEnumUserSearchResults> { let mut result__: <IRTCEnumUserSearchResults as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumUserSearchResults>(result__) } } unsafe impl ::windows::core::Interface for IRTCEnumUserSearchResults { type Vtable = IRTCEnumUserSearchResults_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x83d4d877_aa5d_4a5b_8d0e_002a8067e0e8); } impl ::core::convert::From<IRTCEnumUserSearchResults> for ::windows::core::IUnknown { fn from(value: IRTCEnumUserSearchResults) -> Self { value.0 } } impl ::core::convert::From<&IRTCEnumUserSearchResults> for ::windows::core::IUnknown { fn from(value: &IRTCEnumUserSearchResults) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCEnumUserSearchResults { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCEnumUserSearchResults { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCEnumUserSearchResults_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32, ppelements: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCEnumWatchers(pub ::windows::core::IUnknown); impl IRTCEnumWatchers { pub unsafe fn Next(&self, celt: u32, ppelements: *mut ::core::option::Option<IRTCWatcher>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(ppelements), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IRTCEnumWatchers> { let mut result__: <IRTCEnumWatchers as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumWatchers>(result__) } } unsafe impl ::windows::core::Interface for IRTCEnumWatchers { type Vtable = IRTCEnumWatchers_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa87d55d7_db74_4ed1_9ca4_77a0e41b413e); } impl ::core::convert::From<IRTCEnumWatchers> for ::windows::core::IUnknown { fn from(value: IRTCEnumWatchers) -> Self { value.0 } } impl ::core::convert::From<&IRTCEnumWatchers> for ::windows::core::IUnknown { fn from(value: &IRTCEnumWatchers) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCEnumWatchers { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCEnumWatchers { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCEnumWatchers_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32, ppelements: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCEventNotification(pub ::windows::core::IUnknown); impl IRTCEventNotification { #[cfg(feature = "Win32_System_Com")] pub unsafe fn Event<'a, Param1: ::windows::core::IntoParam<'a, super::Com::IDispatch>>(&self, rtcevent: RTC_EVENT, pevent: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(rtcevent), pevent.into_param().abi()).ok() } } unsafe impl ::windows::core::Interface for IRTCEventNotification { type Vtable = IRTCEventNotification_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x13fa24c7_5748_4b21_91f5_7397609ce747); } impl ::core::convert::From<IRTCEventNotification> for ::windows::core::IUnknown { fn from(value: IRTCEventNotification) -> Self { value.0 } } impl ::core::convert::From<&IRTCEventNotification> for ::windows::core::IUnknown { fn from(value: &IRTCEventNotification) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCEventNotification { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCEventNotification { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCEventNotification_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, rtcevent: RTC_EVENT, pevent: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCInfoEvent(pub ::windows::core::IUnknown); impl IRTCInfoEvent { pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession2> { let mut result__: <IRTCSession2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession2>(result__) } pub unsafe fn Participant(&self) -> ::windows::core::Result<IRTCParticipant> { let mut result__: <IRTCParticipant as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCParticipant>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Info(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn InfoHeader(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCInfoEvent { type Vtable = IRTCInfoEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4e1d68ae_1912_4f49_b2c3_594fadfd425f); } impl ::core::convert::From<IRTCInfoEvent> for ::windows::core::IUnknown { fn from(value: IRTCInfoEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCInfoEvent> for ::windows::core::IUnknown { fn from(value: &IRTCInfoEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCInfoEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCInfoEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCInfoEvent> for super::Com::IDispatch { fn from(value: IRTCInfoEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCInfoEvent> for super::Com::IDispatch { fn from(value: &IRTCInfoEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCInfoEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCInfoEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCInfoEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppparticipant: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrinfo: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrinfoheader: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCIntensityEvent(pub ::windows::core::IUnknown); impl IRTCIntensityEvent { pub unsafe fn Level(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn Min(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn Max(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn Direction(&self) -> ::windows::core::Result<RTC_AUDIO_DEVICE> { let mut result__: <RTC_AUDIO_DEVICE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_AUDIO_DEVICE>(result__) } } unsafe impl ::windows::core::Interface for IRTCIntensityEvent { type Vtable = IRTCIntensityEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4c23bf51_390c_4992_a41d_41eec05b2a4b); } impl ::core::convert::From<IRTCIntensityEvent> for ::windows::core::IUnknown { fn from(value: IRTCIntensityEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCIntensityEvent> for ::windows::core::IUnknown { fn from(value: &IRTCIntensityEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCIntensityEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCIntensityEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCIntensityEvent> for super::Com::IDispatch { fn from(value: IRTCIntensityEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCIntensityEvent> for super::Com::IDispatch { fn from(value: &IRTCIntensityEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCIntensityEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCIntensityEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCIntensityEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pllevel: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmin: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmax: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pendirection: *mut RTC_AUDIO_DEVICE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCMediaEvent(pub ::windows::core::IUnknown); impl IRTCMediaEvent { pub unsafe fn MediaType(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn EventType(&self) -> ::windows::core::Result<RTC_MEDIA_EVENT_TYPE> { let mut result__: <RTC_MEDIA_EVENT_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_MEDIA_EVENT_TYPE>(result__) } pub unsafe fn EventReason(&self) -> ::windows::core::Result<RTC_MEDIA_EVENT_REASON> { let mut result__: <RTC_MEDIA_EVENT_REASON as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_MEDIA_EVENT_REASON>(result__) } } unsafe impl ::windows::core::Interface for IRTCMediaEvent { type Vtable = IRTCMediaEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x099944fb_bcda_453e_8c41_e13da2adf7f3); } impl ::core::convert::From<IRTCMediaEvent> for ::windows::core::IUnknown { fn from(value: IRTCMediaEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCMediaEvent> for ::windows::core::IUnknown { fn from(value: &IRTCMediaEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCMediaEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCMediaEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCMediaEvent> for super::Com::IDispatch { fn from(value: IRTCMediaEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCMediaEvent> for super::Com::IDispatch { fn from(value: &IRTCMediaEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCMediaEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCMediaEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCMediaEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pmediatype: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peneventtype: *mut RTC_MEDIA_EVENT_TYPE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peneventreason: *mut RTC_MEDIA_EVENT_REASON) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCMediaRequestEvent(pub ::windows::core::IUnknown); impl IRTCMediaRequestEvent { pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession2> { let mut result__: <IRTCSession2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession2>(result__) } pub unsafe fn ProposedMedia(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn CurrentMedia(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn Accept(&self, lmediatypes: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatypes)).ok() } pub unsafe fn RemotePreferredSecurityLevel(&self, ensecuritytype: RTC_SECURITY_TYPE) -> ::windows::core::Result<RTC_SECURITY_LEVEL> { let mut result__: <RTC_SECURITY_LEVEL as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(ensecuritytype), &mut result__).from_abi::<RTC_SECURITY_LEVEL>(result__) } pub unsafe fn Reject(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_REINVITE_STATE> { let mut result__: <RTC_REINVITE_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_REINVITE_STATE>(result__) } } unsafe impl ::windows::core::Interface for IRTCMediaRequestEvent { type Vtable = IRTCMediaRequestEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x52572d15_148c_4d97_a36c_2da55c289d63); } impl ::core::convert::From<IRTCMediaRequestEvent> for ::windows::core::IUnknown { fn from(value: IRTCMediaRequestEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCMediaRequestEvent> for ::windows::core::IUnknown { fn from(value: &IRTCMediaRequestEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCMediaRequestEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCMediaRequestEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCMediaRequestEvent> for super::Com::IDispatch { fn from(value: IRTCMediaRequestEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCMediaRequestEvent> for super::Com::IDispatch { fn from(value: &IRTCMediaRequestEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCMediaRequestEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCMediaRequestEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCMediaRequestEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmediatypes: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmediatypes: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatypes: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ensecuritytype: RTC_SECURITY_TYPE, pensecuritylevel: *mut RTC_SECURITY_LEVEL) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pstate: *mut RTC_REINVITE_STATE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCMessagingEvent(pub ::windows::core::IUnknown); impl IRTCMessagingEvent { pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession> { let mut result__: <IRTCSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession>(result__) } pub unsafe fn Participant(&self) -> ::windows::core::Result<IRTCParticipant> { let mut result__: <IRTCParticipant as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCParticipant>(result__) } pub unsafe fn EventType(&self) -> ::windows::core::Result<RTC_MESSAGING_EVENT_TYPE> { let mut result__: <RTC_MESSAGING_EVENT_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_MESSAGING_EVENT_TYPE>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Message(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn MessageHeader(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn UserStatus(&self) -> ::windows::core::Result<RTC_MESSAGING_USER_STATUS> { let mut result__: <RTC_MESSAGING_USER_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_MESSAGING_USER_STATUS>(result__) } } unsafe impl ::windows::core::Interface for IRTCMessagingEvent { type Vtable = IRTCMessagingEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd3609541_1b29_4de5_a4ad_5aebaf319512); } impl ::core::convert::From<IRTCMessagingEvent> for ::windows::core::IUnknown { fn from(value: IRTCMessagingEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCMessagingEvent> for ::windows::core::IUnknown { fn from(value: &IRTCMessagingEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCMessagingEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCMessagingEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCMessagingEvent> for super::Com::IDispatch { fn from(value: IRTCMessagingEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCMessagingEvent> for super::Com::IDispatch { fn from(value: &IRTCMessagingEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCMessagingEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCMessagingEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCMessagingEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppparticipant: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peneventtype: *mut RTC_MESSAGING_EVENT_TYPE) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrmessage: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrmessageheader: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penuserstatus: *mut RTC_MESSAGING_USER_STATUS) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCParticipant(pub ::windows::core::IUnknown); impl IRTCParticipant { #[cfg(feature = "Win32_Foundation")] pub unsafe fn UserURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn Removable(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_PARTICIPANT_STATE> { let mut result__: <RTC_PARTICIPANT_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PARTICIPANT_STATE>(result__) } pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession> { let mut result__: <IRTCSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession>(result__) } } unsafe impl ::windows::core::Interface for IRTCParticipant { type Vtable = IRTCParticipant_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xae86add5_26b1_4414_af1d_b94cd938d739); } impl ::core::convert::From<IRTCParticipant> for ::windows::core::IUnknown { fn from(value: IRTCParticipant) -> Self { value.0 } } impl ::core::convert::From<&IRTCParticipant> for ::windows::core::IUnknown { fn from(value: &IRTCParticipant) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCParticipant { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCParticipant { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCParticipant_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfremovable: *mut i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_PARTICIPANT_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCParticipantStateChangeEvent(pub ::windows::core::IUnknown); impl IRTCParticipantStateChangeEvent { pub unsafe fn Participant(&self) -> ::windows::core::Result<IRTCParticipant> { let mut result__: <IRTCParticipant as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCParticipant>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_PARTICIPANT_STATE> { let mut result__: <RTC_PARTICIPANT_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PARTICIPANT_STATE>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } } unsafe impl ::windows::core::Interface for IRTCParticipantStateChangeEvent { type Vtable = IRTCParticipantStateChangeEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x09bcb597_f0fa_48f9_b420_468cea7fde04); } impl ::core::convert::From<IRTCParticipantStateChangeEvent> for ::windows::core::IUnknown { fn from(value: IRTCParticipantStateChangeEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCParticipantStateChangeEvent> for ::windows::core::IUnknown { fn from(value: &IRTCParticipantStateChangeEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCParticipantStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCParticipantStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCParticipantStateChangeEvent> for super::Com::IDispatch { fn from(value: IRTCParticipantStateChangeEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCParticipantStateChangeEvent> for super::Com::IDispatch { fn from(value: &IRTCParticipantStateChangeEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCParticipantStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCParticipantStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCParticipantStateChangeEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppparticipant: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_PARTICIPANT_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCPortManager(pub ::windows::core::IUnknown); impl IRTCPortManager { #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetMapping<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrremoteaddress: Param0, enporttype: RTC_PORT_TYPE, pbstrinternallocaladdress: *mut super::super::Foundation::BSTR, plinternallocalport: *mut i32, pbstrexternallocaladdress: *mut super::super::Foundation::BSTR, plexternallocalport: *mut i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), bstrremoteaddress.into_param().abi(), ::core::mem::transmute(enporttype), ::core::mem::transmute(pbstrinternallocaladdress), ::core::mem::transmute(plinternallocalport), ::core::mem::transmute(pbstrexternallocaladdress), ::core::mem::transmute(plexternallocalport)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn UpdateRemoteAddress<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrremoteaddress: Param0, bstrinternallocaladdress: Param1, linternallocalport: i32, bstrexternallocaladdress: Param3, lexternallocalport: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrremoteaddress.into_param().abi(), bstrinternallocaladdress.into_param().abi(), ::core::mem::transmute(linternallocalport), bstrexternallocaladdress.into_param().abi(), ::core::mem::transmute(lexternallocalport)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ReleaseMapping<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrinternallocaladdress: Param0, linternallocalport: i32, bstrexternallocaladdress: Param2, lexternallocaladdress: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), bstrinternallocaladdress.into_param().abi(), ::core::mem::transmute(linternallocalport), bstrexternallocaladdress.into_param().abi(), ::core::mem::transmute(lexternallocaladdress)).ok() } } unsafe impl ::windows::core::Interface for IRTCPortManager { type Vtable = IRTCPortManager_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xda77c14b_6208_43ca_8ddf_5b60a0a69fac); } impl ::core::convert::From<IRTCPortManager> for ::windows::core::IUnknown { fn from(value: IRTCPortManager) -> Self { value.0 } } impl ::core::convert::From<&IRTCPortManager> for ::windows::core::IUnknown { fn from(value: &IRTCPortManager) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCPortManager { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCPortManager { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCPortManager_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrremoteaddress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, enporttype: RTC_PORT_TYPE, pbstrinternallocaladdress: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, plinternallocalport: *mut i32, pbstrexternallocaladdress: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, plexternallocalport: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrremoteaddress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrinternallocaladdress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, linternallocalport: i32, bstrexternallocaladdress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, lexternallocalport: i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrinternallocaladdress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, linternallocalport: i32, bstrexternallocaladdress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, lexternallocaladdress: i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCPresenceContact(pub ::windows::core::IUnknown); impl IRTCPresenceContact { #[cfg(feature = "Win32_Foundation")] pub unsafe fn PresentityURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPresentityURI<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrname: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), bstrname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Data(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdata: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrdata.into_param().abi()).ok() } pub unsafe fn Persistent(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } pub unsafe fn SetPersistent(&self, fpersistent: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(fpersistent)).ok() } } unsafe impl ::windows::core::Interface for IRTCPresenceContact { type Vtable = IRTCPresenceContact_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8b22f92c_cd90_42db_a733_212205c3e3df); } impl ::core::convert::From<IRTCPresenceContact> for ::windows::core::IUnknown { fn from(value: IRTCPresenceContact) -> Self { value.0 } } impl ::core::convert::From<&IRTCPresenceContact> for ::windows::core::IUnknown { fn from(value: &IRTCPresenceContact) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCPresenceContact { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCPresenceContact { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCPresenceContact_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrpresentityuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfpersistent: *mut i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fpersistent: i16) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCPresenceDataEvent(pub ::windows::core::IUnknown); impl IRTCPresenceDataEvent { pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetPresenceData(&self, pbstrnamespace: *mut super::super::Foundation::BSTR, pbstrdata: *mut super::super::Foundation::BSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(pbstrnamespace), ::core::mem::transmute(pbstrdata)).ok() } } unsafe impl ::windows::core::Interface for IRTCPresenceDataEvent { type Vtable = IRTCPresenceDataEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x38f0e78c_8b87_4c04_a82d_aedd83c909bb); } impl ::core::convert::From<IRTCPresenceDataEvent> for ::windows::core::IUnknown { fn from(value: IRTCPresenceDataEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCPresenceDataEvent> for ::windows::core::IUnknown { fn from(value: &IRTCPresenceDataEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCPresenceDataEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCPresenceDataEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCPresenceDataEvent> for super::Com::IDispatch { fn from(value: IRTCPresenceDataEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCPresenceDataEvent> for super::Com::IDispatch { fn from(value: &IRTCPresenceDataEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCPresenceDataEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCPresenceDataEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCPresenceDataEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrnamespace: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCPresenceDevice(pub ::windows::core::IUnknown); impl IRTCPresenceDevice { pub unsafe fn Status(&self) -> ::windows::core::Result<RTC_PRESENCE_STATUS> { let mut result__: <RTC_PRESENCE_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PRESENCE_STATUS>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Notes(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn PresenceProperty(&self, enproperty: RTC_PRESENCE_PROPERTY) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(enproperty), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetPresenceData(&self, pbstrnamespace: *mut super::super::Foundation::BSTR, pbstrdata: *mut super::super::Foundation::BSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(pbstrnamespace), ::core::mem::transmute(pbstrdata)).ok() } } unsafe impl ::windows::core::Interface for IRTCPresenceDevice { type Vtable = IRTCPresenceDevice_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbc6a90dd_ad9a_48da_9b0c_2515e38521ad); } impl ::core::convert::From<IRTCPresenceDevice> for ::windows::core::IUnknown { fn from(value: IRTCPresenceDevice) -> Self { value.0 } } impl ::core::convert::From<&IRTCPresenceDevice> for ::windows::core::IUnknown { fn from(value: &IRTCPresenceDevice) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCPresenceDevice { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCPresenceDevice { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCPresenceDevice_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstatus: *mut RTC_PRESENCE_STATUS) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrnotes: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enproperty: RTC_PRESENCE_PROPERTY, pbstrproperty: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrnamespace: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCPresencePropertyEvent(pub ::windows::core::IUnknown); impl IRTCPresencePropertyEvent { pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn PresenceProperty(&self) -> ::windows::core::Result<RTC_PRESENCE_PROPERTY> { let mut result__: <RTC_PRESENCE_PROPERTY as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PRESENCE_PROPERTY>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Value(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCPresencePropertyEvent { type Vtable = IRTCPresencePropertyEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf777f570_a820_49d5_86bd_e099493f1518); } impl ::core::convert::From<IRTCPresencePropertyEvent> for ::windows::core::IUnknown { fn from(value: IRTCPresencePropertyEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCPresencePropertyEvent> for ::windows::core::IUnknown { fn from(value: &IRTCPresencePropertyEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCPresencePropertyEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCPresencePropertyEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCPresencePropertyEvent> for super::Com::IDispatch { fn from(value: IRTCPresencePropertyEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCPresencePropertyEvent> for super::Com::IDispatch { fn from(value: &IRTCPresencePropertyEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCPresencePropertyEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCPresencePropertyEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCPresencePropertyEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penpresprop: *mut RTC_PRESENCE_PROPERTY) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrvalue: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCPresenceStatusEvent(pub ::windows::core::IUnknown); impl IRTCPresenceStatusEvent { pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetLocalPresenceInfo(&self, penstatus: *mut RTC_PRESENCE_STATUS, pbstrnotes: *mut super::super::Foundation::BSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(penstatus), ::core::mem::transmute(pbstrnotes)).ok() } } unsafe impl ::windows::core::Interface for IRTCPresenceStatusEvent { type Vtable = IRTCPresenceStatusEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x78673f32_4a0f_462c_89aa_ee7706707678); } impl ::core::convert::From<IRTCPresenceStatusEvent> for ::windows::core::IUnknown { fn from(value: IRTCPresenceStatusEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCPresenceStatusEvent> for ::windows::core::IUnknown { fn from(value: &IRTCPresenceStatusEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCPresenceStatusEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCPresenceStatusEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCPresenceStatusEvent> for super::Com::IDispatch { fn from(value: IRTCPresenceStatusEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCPresenceStatusEvent> for super::Com::IDispatch { fn from(value: &IRTCPresenceStatusEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCPresenceStatusEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCPresenceStatusEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCPresenceStatusEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstatus: *mut RTC_PRESENCE_STATUS, pbstrnotes: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCProfile(pub ::windows::core::IUnknown); impl IRTCProfile { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Key(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn XML(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ProviderName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ProviderURI(&self, enuri: RTC_PROVIDER_URI) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(enuri), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ProviderData(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn ClientBanner(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientMinVer(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientCurVer(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientUpdateURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientData(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn UserURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn UserName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn UserAccount(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetCredentials<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstruseruri: Param0, bstruseraccount: Param1, bstrpassword: Param2) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), bstruseruri.into_param().abi(), bstruseraccount.into_param().abi(), bstrpassword.into_param().abi()).ok() } pub unsafe fn SessionCapabilities(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_REGISTRATION_STATE> { let mut result__: <RTC_REGISTRATION_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_REGISTRATION_STATE>(result__) } } unsafe impl ::windows::core::Interface for IRTCProfile { type Vtable = IRTCProfile_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd07eca9e_4062_4dd4_9e7d_722a49ba7303); } impl ::core::convert::From<IRTCProfile> for ::windows::core::IUnknown { fn from(value: IRTCProfile) -> Self { value.0 } } impl ::core::convert::From<&IRTCProfile> for ::windows::core::IUnknown { fn from(value: &IRTCProfile) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCProfile { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCProfile { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCProfile_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrkey: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrxml: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enuri: RTC_PROVIDER_URI, pbstruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfbanner: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrminver: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrcurver: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrupdateuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrusername: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseraccount: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstruseruri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstruseraccount: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plsupportedsessions: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_REGISTRATION_STATE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCProfile2(pub ::windows::core::IUnknown); impl IRTCProfile2 { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Key(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn XML(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ProviderName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ProviderURI(&self, enuri: RTC_PROVIDER_URI) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(enuri), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ProviderData(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn ClientBanner(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientMinVer(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientCurVer(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientUpdateURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ClientData(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn UserURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn UserName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn UserAccount(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetCredentials<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstruseruri: Param0, bstruseraccount: Param1, bstrpassword: Param2) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), bstruseruri.into_param().abi(), bstruseraccount.into_param().abi(), bstrpassword.into_param().abi()).ok() } pub unsafe fn SessionCapabilities(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_REGISTRATION_STATE> { let mut result__: <RTC_REGISTRATION_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_REGISTRATION_STATE>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Realm(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetRealm<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrrealm: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), bstrrealm.into_param().abi()).ok() } pub unsafe fn AllowedAuth(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn SetAllowedAuth(&self, lallowedauth: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), ::core::mem::transmute(lallowedauth)).ok() } } unsafe impl ::windows::core::Interface for IRTCProfile2 { type Vtable = IRTCProfile2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4b81f84e_bdc7_4184_9154_3cb2dd7917fb); } impl ::core::convert::From<IRTCProfile2> for ::windows::core::IUnknown { fn from(value: IRTCProfile2) -> Self { value.0 } } impl ::core::convert::From<&IRTCProfile2> for ::windows::core::IUnknown { fn from(value: &IRTCProfile2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCProfile2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCProfile2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCProfile2> for IRTCProfile { fn from(value: IRTCProfile2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCProfile2> for IRTCProfile { fn from(value: &IRTCProfile2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCProfile> for IRTCProfile2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCProfile> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCProfile> for &IRTCProfile2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCProfile> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCProfile2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrkey: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrxml: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enuri: RTC_PROVIDER_URI, pbstruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfbanner: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrminver: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrcurver: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrupdateuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrusername: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseraccount: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstruseruri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstruseraccount: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plsupportedsessions: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_REGISTRATION_STATE) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrrealm: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrrealm: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plallowedauth: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lallowedauth: i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCProfileEvent(pub ::windows::core::IUnknown); impl IRTCProfileEvent { pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile> { let mut result__: <IRTCProfile as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile>(result__) } pub unsafe fn Cookie(&self) -> ::windows::core::Result<isize> { let mut result__: <isize as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<isize>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } } unsafe impl ::windows::core::Interface for IRTCProfileEvent { type Vtable = IRTCProfileEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd6d5ab3b_770e_43e8_800a_79b062395fca); } impl ::core::convert::From<IRTCProfileEvent> for ::windows::core::IUnknown { fn from(value: IRTCProfileEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCProfileEvent> for ::windows::core::IUnknown { fn from(value: &IRTCProfileEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCProfileEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCProfileEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCProfileEvent> for super::Com::IDispatch { fn from(value: IRTCProfileEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCProfileEvent> for super::Com::IDispatch { fn from(value: &IRTCProfileEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCProfileEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCProfileEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCProfileEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plcookie: *mut isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCProfileEvent2(pub ::windows::core::IUnknown); impl IRTCProfileEvent2 { pub unsafe fn GetTypeInfoCount(&self) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_System_Com")] pub unsafe fn GetTypeInfo(&self, itinfo: u32, lcid: u32) -> ::windows::core::Result<super::Com::ITypeInfo> { let mut result__: <super::Com::ITypeInfo as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(itinfo), ::core::mem::transmute(lcid), &mut result__).from_abi::<super::Com::ITypeInfo>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetIDsOfNames(&self, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(rgsznames), ::core::mem::transmute(cnames), ::core::mem::transmute(lcid), ::core::mem::transmute(rgdispid)).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Invoke(&self, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut super::Com::VARIANT, pexcepinfo: *mut super::Com::EXCEPINFO, puargerr: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)( ::core::mem::transmute_copy(self), ::core::mem::transmute(dispidmember), ::core::mem::transmute(riid), ::core::mem::transmute(lcid), ::core::mem::transmute(wflags), ::core::mem::transmute(pdispparams), ::core::mem::transmute(pvarresult), ::core::mem::transmute(pexcepinfo), ::core::mem::transmute(puargerr), ) .ok() } pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile> { let mut result__: <IRTCProfile as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile>(result__) } pub unsafe fn Cookie(&self) -> ::windows::core::Result<isize> { let mut result__: <isize as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<isize>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn EventType(&self) -> ::windows::core::Result<RTC_PROFILE_EVENT_TYPE> { let mut result__: <RTC_PROFILE_EVENT_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_PROFILE_EVENT_TYPE>(result__) } } unsafe impl ::windows::core::Interface for IRTCProfileEvent2 { type Vtable = IRTCProfileEvent2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x62e56edc_03fa_4121_94fb_23493fd0ae64); } impl ::core::convert::From<IRTCProfileEvent2> for ::windows::core::IUnknown { fn from(value: IRTCProfileEvent2) -> Self { value.0 } } impl ::core::convert::From<&IRTCProfileEvent2> for ::windows::core::IUnknown { fn from(value: &IRTCProfileEvent2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCProfileEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCProfileEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCProfileEvent2> for IRTCProfileEvent { fn from(value: IRTCProfileEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCProfileEvent2> for IRTCProfileEvent { fn from(value: &IRTCProfileEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCProfileEvent> for IRTCProfileEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCProfileEvent> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCProfileEvent> for &IRTCProfileEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCProfileEvent> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCProfileEvent2> for super::Com::IDispatch { fn from(value: IRTCProfileEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCProfileEvent2> for super::Com::IDispatch { fn from(value: &IRTCProfileEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCProfileEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCProfileEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCProfileEvent2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plcookie: *mut isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peventtype: *mut RTC_PROFILE_EVENT_TYPE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCReInviteEvent(pub ::windows::core::IUnknown); impl IRTCReInviteEvent { pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession2> { let mut result__: <IRTCSession2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession2>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Accept<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrcontenttype: Param0, bstrsessiondescription: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrcontenttype.into_param().abi(), bstrsessiondescription.into_param().abi()).ok() } pub unsafe fn Reject(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_REINVITE_STATE> { let mut result__: <RTC_REINVITE_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_REINVITE_STATE>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetRemoteSessionDescription(&self, pbstrcontenttype: *mut super::super::Foundation::BSTR, pbstrsessiondescription: *mut super::super::Foundation::BSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(pbstrcontenttype), ::core::mem::transmute(pbstrsessiondescription)).ok() } } unsafe impl ::windows::core::Interface for IRTCReInviteEvent { type Vtable = IRTCReInviteEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x11558d84_204c_43e7_99b0_2034e9417f7d); } impl ::core::convert::From<IRTCReInviteEvent> for ::windows::core::IUnknown { fn from(value: IRTCReInviteEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCReInviteEvent> for ::windows::core::IUnknown { fn from(value: &IRTCReInviteEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCReInviteEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCReInviteEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCReInviteEvent> for super::Com::IDispatch { fn from(value: IRTCReInviteEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCReInviteEvent> for super::Com::IDispatch { fn from(value: &IRTCReInviteEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCReInviteEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCReInviteEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCReInviteEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession2: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrcontenttype: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrsessiondescription: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pstate: *mut RTC_REINVITE_STATE) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrcontenttype: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbstrsessiondescription: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCRegistrationStateChangeEvent(pub ::windows::core::IUnknown); impl IRTCRegistrationStateChangeEvent { pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile> { let mut result__: <IRTCProfile as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_REGISTRATION_STATE> { let mut result__: <RTC_REGISTRATION_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_REGISTRATION_STATE>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCRegistrationStateChangeEvent { type Vtable = IRTCRegistrationStateChangeEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x62d0991b_50ab_4f02_b948_ca94f26f8f95); } impl ::core::convert::From<IRTCRegistrationStateChangeEvent> for ::windows::core::IUnknown { fn from(value: IRTCRegistrationStateChangeEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCRegistrationStateChangeEvent> for ::windows::core::IUnknown { fn from(value: &IRTCRegistrationStateChangeEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCRegistrationStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCRegistrationStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCRegistrationStateChangeEvent> for super::Com::IDispatch { fn from(value: IRTCRegistrationStateChangeEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCRegistrationStateChangeEvent> for super::Com::IDispatch { fn from(value: &IRTCRegistrationStateChangeEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCRegistrationStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCRegistrationStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCRegistrationStateChangeEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_REGISTRATION_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCRoamingEvent(pub ::windows::core::IUnknown); impl IRTCRoamingEvent { pub unsafe fn EventType(&self) -> ::windows::core::Result<RTC_ROAMING_EVENT_TYPE> { let mut result__: <RTC_ROAMING_EVENT_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_ROAMING_EVENT_TYPE>(result__) } pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile2> { let mut result__: <IRTCProfile2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile2>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCRoamingEvent { type Vtable = IRTCRoamingEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x79960a6b_0cb1_4dc8_a805_7318e99902e8); } impl ::core::convert::From<IRTCRoamingEvent> for ::windows::core::IUnknown { fn from(value: IRTCRoamingEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCRoamingEvent> for ::windows::core::IUnknown { fn from(value: &IRTCRoamingEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCRoamingEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCRoamingEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCRoamingEvent> for super::Com::IDispatch { fn from(value: IRTCRoamingEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCRoamingEvent> for super::Com::IDispatch { fn from(value: &IRTCRoamingEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCRoamingEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCRoamingEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCRoamingEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peventtype: *mut RTC_ROAMING_EVENT_TYPE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSession(pub ::windows::core::IUnknown); impl IRTCSession { pub unsafe fn Client(&self) -> ::windows::core::Result<IRTCClient> { let mut result__: <IRTCClient as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCClient>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_SESSION_STATE> { let mut result__: <RTC_SESSION_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_SESSION_STATE>(result__) } pub unsafe fn Type(&self) -> ::windows::core::Result<RTC_SESSION_TYPE> { let mut result__: <RTC_SESSION_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_SESSION_TYPE>(result__) } pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile> { let mut result__: <IRTCProfile as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile>(result__) } pub unsafe fn Participants(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } pub unsafe fn Answer(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Terminate(&self, enreason: RTC_TERMINATE_REASON) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(enreason)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Redirect<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, entype: RTC_SESSION_TYPE, bstrlocalphoneuri: Param1, pprofile: Param2, lflags: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(entype), bstrlocalphoneuri.into_param().abi(), pprofile.into_param().abi(), ::core::mem::transmute(lflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddParticipant<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstraddress: Param0, bstrname: Param1) -> ::windows::core::Result<IRTCParticipant> { let mut result__: <IRTCParticipant as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), bstraddress.into_param().abi(), bstrname.into_param().abi(), &mut result__).from_abi::<IRTCParticipant>(result__) } pub unsafe fn RemoveParticipant<'a, Param0: ::windows::core::IntoParam<'a, IRTCParticipant>>(&self, pparticipant: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), pparticipant.into_param().abi()).ok() } pub unsafe fn EnumerateParticipants(&self) -> ::windows::core::Result<IRTCEnumParticipants> { let mut result__: <IRTCEnumParticipants as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumParticipants>(result__) } pub unsafe fn CanAddParticipants(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RedirectedUserURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RedirectedUserName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn NextRedirectedUser(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SendMessage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrmessageheader: Param0, bstrmessage: Param1, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), bstrmessageheader.into_param().abi(), bstrmessage.into_param().abi(), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn SendMessageStatus(&self, enuserstatus: RTC_MESSAGING_USER_STATUS, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(enuserstatus), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn AddStream(&self, lmediatype: i32, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatype), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn RemoveStream(&self, lmediatype: i32, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatype), ::core::mem::transmute(lcookie)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetEncryptionKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, lmediatype: i32, encryptionkey: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatype), encryptionkey.into_param().abi()).ok() } } unsafe impl ::windows::core::Interface for IRTCSession { type Vtable = IRTCSession_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x387c8086_99be_42fb_9973_7c0fc0ca9fa8); } impl ::core::convert::From<IRTCSession> for ::windows::core::IUnknown { fn from(value: IRTCSession) -> Self { value.0 } } impl ::core::convert::From<&IRTCSession> for ::windows::core::IUnknown { fn from(value: &IRTCSession) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSession { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSession { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSession_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppclient: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_SESSION_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pentype: *mut RTC_SESSION_TYPE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enreason: RTC_TERMINATE_REASON) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, entype: RTC_SESSION_TYPE, bstrlocalphoneuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pprofile: ::windows::core::RawPtr, lflags: i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstraddress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppparticipant: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pparticipant: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfcanadd: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrusername: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrmessageheader: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrmessage: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enuserstatus: RTC_MESSAGING_USER_STATUS, lcookie: isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatype: i32, lcookie: isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatype: i32, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatype: i32, encryptionkey: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSession2(pub ::windows::core::IUnknown); impl IRTCSession2 { pub unsafe fn Client(&self) -> ::windows::core::Result<IRTCClient> { let mut result__: <IRTCClient as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCClient>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_SESSION_STATE> { let mut result__: <RTC_SESSION_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_SESSION_STATE>(result__) } pub unsafe fn Type(&self) -> ::windows::core::Result<RTC_SESSION_TYPE> { let mut result__: <RTC_SESSION_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_SESSION_TYPE>(result__) } pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile> { let mut result__: <IRTCProfile as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile>(result__) } pub unsafe fn Participants(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } pub unsafe fn Answer(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Terminate(&self, enreason: RTC_TERMINATE_REASON) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(enreason)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Redirect<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, entype: RTC_SESSION_TYPE, bstrlocalphoneuri: Param1, pprofile: Param2, lflags: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(entype), bstrlocalphoneuri.into_param().abi(), pprofile.into_param().abi(), ::core::mem::transmute(lflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddParticipant<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstraddress: Param0, bstrname: Param1) -> ::windows::core::Result<IRTCParticipant> { let mut result__: <IRTCParticipant as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), bstraddress.into_param().abi(), bstrname.into_param().abi(), &mut result__).from_abi::<IRTCParticipant>(result__) } pub unsafe fn RemoveParticipant<'a, Param0: ::windows::core::IntoParam<'a, IRTCParticipant>>(&self, pparticipant: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), pparticipant.into_param().abi()).ok() } pub unsafe fn EnumerateParticipants(&self) -> ::windows::core::Result<IRTCEnumParticipants> { let mut result__: <IRTCEnumParticipants as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumParticipants>(result__) } pub unsafe fn CanAddParticipants(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RedirectedUserURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RedirectedUserName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn NextRedirectedUser(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SendMessage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrmessageheader: Param0, bstrmessage: Param1, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), bstrmessageheader.into_param().abi(), bstrmessage.into_param().abi(), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn SendMessageStatus(&self, enuserstatus: RTC_MESSAGING_USER_STATUS, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(enuserstatus), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn AddStream(&self, lmediatype: i32, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatype), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn RemoveStream(&self, lmediatype: i32, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatype), ::core::mem::transmute(lcookie)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetEncryptionKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, lmediatype: i32, encryptionkey: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), ::core::mem::transmute(lmediatype), encryptionkey.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SendInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrinfoheader: Param0, bstrinfo: Param1, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), bstrinfoheader.into_param().abi(), bstrinfo.into_param().abi(), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn SetPreferredSecurityLevel(&self, ensecuritytype: RTC_SECURITY_TYPE, ensecuritylevel: RTC_SECURITY_LEVEL) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), ::core::mem::transmute(ensecuritytype), ::core::mem::transmute(ensecuritylevel)).ok() } pub unsafe fn PreferredSecurityLevel(&self, ensecuritytype: RTC_SECURITY_TYPE) -> ::windows::core::Result<RTC_SECURITY_LEVEL> { let mut result__: <RTC_SECURITY_LEVEL as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), ::core::mem::transmute(ensecuritytype), &mut result__).from_abi::<RTC_SECURITY_LEVEL>(result__) } pub unsafe fn IsSecurityEnabled(&self, ensecuritytype: RTC_SECURITY_TYPE) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self), ::core::mem::transmute(ensecuritytype), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn AnswerWithSessionDescription<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrcontenttype: Param0, bstrsessiondescription: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self), bstrcontenttype.into_param().abi(), bstrsessiondescription.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ReInviteWithSessionDescription<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrcontenttype: Param0, bstrsessiondescription: Param1, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).28)(::core::mem::transmute_copy(self), bstrcontenttype.into_param().abi(), bstrsessiondescription.into_param().abi(), ::core::mem::transmute(lcookie)).ok() } } unsafe impl ::windows::core::Interface for IRTCSession2 { type Vtable = IRTCSession2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x17d7cdfc_b007_484c_99d2_86a8a820991d); } impl ::core::convert::From<IRTCSession2> for ::windows::core::IUnknown { fn from(value: IRTCSession2) -> Self { value.0 } } impl ::core::convert::From<&IRTCSession2> for ::windows::core::IUnknown { fn from(value: &IRTCSession2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSession2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSession2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCSession2> for IRTCSession { fn from(value: IRTCSession2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCSession2> for IRTCSession { fn from(value: &IRTCSession2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCSession> for IRTCSession2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCSession> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCSession> for &IRTCSession2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCSession> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSession2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppclient: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_SESSION_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pentype: *mut RTC_SESSION_TYPE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enreason: RTC_TERMINATE_REASON) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, entype: RTC_SESSION_TYPE, bstrlocalphoneuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pprofile: ::windows::core::RawPtr, lflags: i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstraddress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppparticipant: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pparticipant: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfcanadd: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstruseruri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrusername: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrmessageheader: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrmessage: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enuserstatus: RTC_MESSAGING_USER_STATUS, lcookie: isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatype: i32, lcookie: isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatype: i32, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lmediatype: i32, encryptionkey: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrinfoheader: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrinfo: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ensecuritytype: RTC_SECURITY_TYPE, ensecuritylevel: RTC_SECURITY_LEVEL) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ensecuritytype: RTC_SECURITY_TYPE, pensecuritylevel: *mut RTC_SECURITY_LEVEL) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ensecuritytype: RTC_SECURITY_TYPE, pfsecurityenabled: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrcontenttype: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrsessiondescription: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrcontenttype: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrsessiondescription: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionCallControl(pub ::windows::core::IUnknown); impl IRTCSessionCallControl { pub unsafe fn Hold(&self, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(lcookie)).ok() } pub unsafe fn UnHold(&self, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(lcookie)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Forward<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrforwardtouri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), bstrforwardtouri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Refer<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrrefertouri: Param0, bstrrefercookie: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), bstrrefertouri.into_param().abi(), bstrrefercookie.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetReferredByURI<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrreferredbyuri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), bstrreferredbyuri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ReferredByURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetReferCookie<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrrefercookie: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), bstrrefercookie.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ReferCookie(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn IsReferred(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } } unsafe impl ::windows::core::Interface for IRTCSessionCallControl { type Vtable = IRTCSessionCallControl_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe9a50d94_190b_4f82_9530_3b8ebf60758a); } impl ::core::convert::From<IRTCSessionCallControl> for ::windows::core::IUnknown { fn from(value: IRTCSessionCallControl) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionCallControl> for ::windows::core::IUnknown { fn from(value: &IRTCSessionCallControl) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionCallControl { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionCallControl { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionCallControl_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lcookie: isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lcookie: isize) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrforwardtouri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrrefertouri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrrefercookie: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrreferredbyuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrreferredbyuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrrefercookie: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrrefercookie: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfisreferred: *mut i16) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionDescriptionManager(pub ::windows::core::IUnknown); impl IRTCSessionDescriptionManager { #[cfg(feature = "Win32_Foundation")] pub unsafe fn EvaluateSessionDescription<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrcontenttype: Param0, bstrsessiondescription: Param1, pfapplicationsession: *mut i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), bstrcontenttype.into_param().abi(), bstrsessiondescription.into_param().abi(), ::core::mem::transmute(pfapplicationsession)).ok() } } unsafe impl ::windows::core::Interface for IRTCSessionDescriptionManager { type Vtable = IRTCSessionDescriptionManager_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xba7f518e_d336_4070_93a6_865395c843f9); } impl ::core::convert::From<IRTCSessionDescriptionManager> for ::windows::core::IUnknown { fn from(value: IRTCSessionDescriptionManager) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionDescriptionManager> for ::windows::core::IUnknown { fn from(value: &IRTCSessionDescriptionManager) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionDescriptionManager { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionDescriptionManager { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionDescriptionManager_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrcontenttype: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrsessiondescription: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pfapplicationsession: *mut i16) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionOperationCompleteEvent(pub ::windows::core::IUnknown); impl IRTCSessionOperationCompleteEvent { pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession> { let mut result__: <IRTCSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession>(result__) } pub unsafe fn Cookie(&self) -> ::windows::core::Result<isize> { let mut result__: <isize as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<isize>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCSessionOperationCompleteEvent { type Vtable = IRTCSessionOperationCompleteEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa6bff4c0_f7c8_4d3c_9a41_3550f78a95b0); } impl ::core::convert::From<IRTCSessionOperationCompleteEvent> for ::windows::core::IUnknown { fn from(value: IRTCSessionOperationCompleteEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionOperationCompleteEvent> for ::windows::core::IUnknown { fn from(value: &IRTCSessionOperationCompleteEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionOperationCompleteEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionOperationCompleteEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCSessionOperationCompleteEvent> for super::Com::IDispatch { fn from(value: IRTCSessionOperationCompleteEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCSessionOperationCompleteEvent> for super::Com::IDispatch { fn from(value: &IRTCSessionOperationCompleteEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCSessionOperationCompleteEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCSessionOperationCompleteEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionOperationCompleteEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plcookie: *mut isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionOperationCompleteEvent2(pub ::windows::core::IUnknown); impl IRTCSessionOperationCompleteEvent2 { pub unsafe fn GetTypeInfoCount(&self) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_System_Com")] pub unsafe fn GetTypeInfo(&self, itinfo: u32, lcid: u32) -> ::windows::core::Result<super::Com::ITypeInfo> { let mut result__: <super::Com::ITypeInfo as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(itinfo), ::core::mem::transmute(lcid), &mut result__).from_abi::<super::Com::ITypeInfo>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetIDsOfNames(&self, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(rgsznames), ::core::mem::transmute(cnames), ::core::mem::transmute(lcid), ::core::mem::transmute(rgdispid)).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Invoke(&self, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut super::Com::VARIANT, pexcepinfo: *mut super::Com::EXCEPINFO, puargerr: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)( ::core::mem::transmute_copy(self), ::core::mem::transmute(dispidmember), ::core::mem::transmute(riid), ::core::mem::transmute(lcid), ::core::mem::transmute(wflags), ::core::mem::transmute(pdispparams), ::core::mem::transmute(pvarresult), ::core::mem::transmute(pexcepinfo), ::core::mem::transmute(puargerr), ) .ok() } pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession> { let mut result__: <IRTCSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession>(result__) } pub unsafe fn Cookie(&self) -> ::windows::core::Result<isize> { let mut result__: <isize as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<isize>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn Participant(&self) -> ::windows::core::Result<IRTCParticipant> { let mut result__: <IRTCParticipant as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCParticipant>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetRemoteSessionDescription(&self, pbstrcontenttype: *mut super::super::Foundation::BSTR, pbstrsessiondescription: *mut super::super::Foundation::BSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(pbstrcontenttype), ::core::mem::transmute(pbstrsessiondescription)).ok() } } unsafe impl ::windows::core::Interface for IRTCSessionOperationCompleteEvent2 { type Vtable = IRTCSessionOperationCompleteEvent2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf6fc2a9b_d5bc_4241_b436_1b8460c13832); } impl ::core::convert::From<IRTCSessionOperationCompleteEvent2> for ::windows::core::IUnknown { fn from(value: IRTCSessionOperationCompleteEvent2) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionOperationCompleteEvent2> for ::windows::core::IUnknown { fn from(value: &IRTCSessionOperationCompleteEvent2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionOperationCompleteEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionOperationCompleteEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCSessionOperationCompleteEvent2> for IRTCSessionOperationCompleteEvent { fn from(value: IRTCSessionOperationCompleteEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCSessionOperationCompleteEvent2> for IRTCSessionOperationCompleteEvent { fn from(value: &IRTCSessionOperationCompleteEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCSessionOperationCompleteEvent> for IRTCSessionOperationCompleteEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCSessionOperationCompleteEvent> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCSessionOperationCompleteEvent> for &IRTCSessionOperationCompleteEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCSessionOperationCompleteEvent> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCSessionOperationCompleteEvent2> for super::Com::IDispatch { fn from(value: IRTCSessionOperationCompleteEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCSessionOperationCompleteEvent2> for super::Com::IDispatch { fn from(value: &IRTCSessionOperationCompleteEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCSessionOperationCompleteEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCSessionOperationCompleteEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionOperationCompleteEvent2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plcookie: *mut isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppparticipant: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrcontenttype: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbstrsessiondescription: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionPortManagement(pub ::windows::core::IUnknown); impl IRTCSessionPortManagement { pub unsafe fn SetPortManager<'a, Param0: ::windows::core::IntoParam<'a, IRTCPortManager>>(&self, pportmanager: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pportmanager.into_param().abi()).ok() } } unsafe impl ::windows::core::Interface for IRTCSessionPortManagement { type Vtable = IRTCSessionPortManagement_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa072f1d6_0286_4e1f_85f2_17a2948456ec); } impl ::core::convert::From<IRTCSessionPortManagement> for ::windows::core::IUnknown { fn from(value: IRTCSessionPortManagement) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionPortManagement> for ::windows::core::IUnknown { fn from(value: &IRTCSessionPortManagement) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionPortManagement { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionPortManagement { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionPortManagement_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pportmanager: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionReferStatusEvent(pub ::windows::core::IUnknown); impl IRTCSessionReferStatusEvent { pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession2> { let mut result__: <IRTCSession2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession2>(result__) } pub unsafe fn ReferStatus(&self) -> ::windows::core::Result<RTC_SESSION_REFER_STATUS> { let mut result__: <RTC_SESSION_REFER_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_SESSION_REFER_STATUS>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCSessionReferStatusEvent { type Vtable = IRTCSessionReferStatusEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3d8fc2cd_5d76_44ab_bb68_2a80353b34a2); } impl ::core::convert::From<IRTCSessionReferStatusEvent> for ::windows::core::IUnknown { fn from(value: IRTCSessionReferStatusEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionReferStatusEvent> for ::windows::core::IUnknown { fn from(value: &IRTCSessionReferStatusEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionReferStatusEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionReferStatusEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCSessionReferStatusEvent> for super::Com::IDispatch { fn from(value: IRTCSessionReferStatusEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCSessionReferStatusEvent> for super::Com::IDispatch { fn from(value: &IRTCSessionReferStatusEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCSessionReferStatusEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCSessionReferStatusEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionReferStatusEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penreferstatus: *mut RTC_SESSION_REFER_STATUS) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionReferredEvent(pub ::windows::core::IUnknown); impl IRTCSessionReferredEvent { pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession2> { let mut result__: <IRTCSession2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession2>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ReferredByURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ReferToURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn ReferCookie(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn Accept(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Reject(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn SetReferredSessionState(&self, enstate: RTC_SESSION_STATE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), ::core::mem::transmute(enstate)).ok() } } unsafe impl ::windows::core::Interface for IRTCSessionReferredEvent { type Vtable = IRTCSessionReferredEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x176a6828_4fcc_4f28_a862_04597a6cf1c4); } impl ::core::convert::From<IRTCSessionReferredEvent> for ::windows::core::IUnknown { fn from(value: IRTCSessionReferredEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionReferredEvent> for ::windows::core::IUnknown { fn from(value: &IRTCSessionReferredEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionReferredEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionReferredEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCSessionReferredEvent> for super::Com::IDispatch { fn from(value: IRTCSessionReferredEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCSessionReferredEvent> for super::Com::IDispatch { fn from(value: &IRTCSessionReferredEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCSessionReferredEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCSessionReferredEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionReferredEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrreferredbyuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrreferouri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrrefercookie: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enstate: RTC_SESSION_STATE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionStateChangeEvent(pub ::windows::core::IUnknown); impl IRTCSessionStateChangeEvent { pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession> { let mut result__: <IRTCSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_SESSION_STATE> { let mut result__: <RTC_SESSION_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_SESSION_STATE>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCSessionStateChangeEvent { type Vtable = IRTCSessionStateChangeEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb5bad703_5952_48b3_9321_7f4500521506); } impl ::core::convert::From<IRTCSessionStateChangeEvent> for ::windows::core::IUnknown { fn from(value: IRTCSessionStateChangeEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionStateChangeEvent> for ::windows::core::IUnknown { fn from(value: &IRTCSessionStateChangeEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCSessionStateChangeEvent> for super::Com::IDispatch { fn from(value: IRTCSessionStateChangeEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCSessionStateChangeEvent> for super::Com::IDispatch { fn from(value: &IRTCSessionStateChangeEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCSessionStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCSessionStateChangeEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionStateChangeEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_SESSION_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCSessionStateChangeEvent2(pub ::windows::core::IUnknown); impl IRTCSessionStateChangeEvent2 { pub unsafe fn GetTypeInfoCount(&self) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_System_Com")] pub unsafe fn GetTypeInfo(&self, itinfo: u32, lcid: u32) -> ::windows::core::Result<super::Com::ITypeInfo> { let mut result__: <super::Com::ITypeInfo as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(itinfo), ::core::mem::transmute(lcid), &mut result__).from_abi::<super::Com::ITypeInfo>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetIDsOfNames(&self, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(rgsznames), ::core::mem::transmute(cnames), ::core::mem::transmute(lcid), ::core::mem::transmute(rgdispid)).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Invoke(&self, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut super::Com::VARIANT, pexcepinfo: *mut super::Com::EXCEPINFO, puargerr: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)( ::core::mem::transmute_copy(self), ::core::mem::transmute(dispidmember), ::core::mem::transmute(riid), ::core::mem::transmute(lcid), ::core::mem::transmute(wflags), ::core::mem::transmute(pdispparams), ::core::mem::transmute(pvarresult), ::core::mem::transmute(pexcepinfo), ::core::mem::transmute(puargerr), ) .ok() } pub unsafe fn Session(&self) -> ::windows::core::Result<IRTCSession> { let mut result__: <IRTCSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCSession>(result__) } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_SESSION_STATE> { let mut result__: <RTC_SESSION_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_SESSION_STATE>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn StatusText(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn MediaTypes(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn RemotePreferredSecurityLevel(&self, ensecuritytype: RTC_SECURITY_TYPE) -> ::windows::core::Result<RTC_SECURITY_LEVEL> { let mut result__: <RTC_SECURITY_LEVEL as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(ensecuritytype), &mut result__).from_abi::<RTC_SECURITY_LEVEL>(result__) } pub unsafe fn IsForked(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetRemoteSessionDescription(&self, pbstrcontenttype: *mut super::super::Foundation::BSTR, pbstrsessiondescription: *mut super::super::Foundation::BSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(pbstrcontenttype), ::core::mem::transmute(pbstrsessiondescription)).ok() } } unsafe impl ::windows::core::Interface for IRTCSessionStateChangeEvent2 { type Vtable = IRTCSessionStateChangeEvent2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4f933171_6f95_4880_80d9_2ec8d495d261); } impl ::core::convert::From<IRTCSessionStateChangeEvent2> for ::windows::core::IUnknown { fn from(value: IRTCSessionStateChangeEvent2) -> Self { value.0 } } impl ::core::convert::From<&IRTCSessionStateChangeEvent2> for ::windows::core::IUnknown { fn from(value: &IRTCSessionStateChangeEvent2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCSessionStateChangeEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCSessionStateChangeEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCSessionStateChangeEvent2> for IRTCSessionStateChangeEvent { fn from(value: IRTCSessionStateChangeEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCSessionStateChangeEvent2> for IRTCSessionStateChangeEvent { fn from(value: &IRTCSessionStateChangeEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCSessionStateChangeEvent> for IRTCSessionStateChangeEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCSessionStateChangeEvent> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCSessionStateChangeEvent> for &IRTCSessionStateChangeEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCSessionStateChangeEvent> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCSessionStateChangeEvent2> for super::Com::IDispatch { fn from(value: IRTCSessionStateChangeEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCSessionStateChangeEvent2> for super::Com::IDispatch { fn from(value: &IRTCSessionStateChangeEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCSessionStateChangeEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCSessionStateChangeEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCSessionStateChangeEvent2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_SESSION_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrstatustext: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pmediatypes: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ensecuritytype: RTC_SECURITY_TYPE, pensecuritylevel: *mut RTC_SECURITY_LEVEL) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfisforked: *mut i16) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrcontenttype: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbstrsessiondescription: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCUserSearch(pub ::windows::core::IUnknown); impl IRTCUserSearch { pub unsafe fn CreateQuery(&self) -> ::windows::core::Result<IRTCUserSearchQuery> { let mut result__: <IRTCUserSearchQuery as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCUserSearchQuery>(result__) } pub unsafe fn ExecuteSearch<'a, Param0: ::windows::core::IntoParam<'a, IRTCUserSearchQuery>, Param1: ::windows::core::IntoParam<'a, IRTCProfile>>(&self, pquery: Param0, pprofile: Param1, lcookie: isize) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pquery.into_param().abi(), pprofile.into_param().abi(), ::core::mem::transmute(lcookie)).ok() } } unsafe impl ::windows::core::Interface for IRTCUserSearch { type Vtable = IRTCUserSearch_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb619882b_860c_4db4_be1b_693b6505bbe5); } impl ::core::convert::From<IRTCUserSearch> for ::windows::core::IUnknown { fn from(value: IRTCUserSearch) -> Self { value.0 } } impl ::core::convert::From<&IRTCUserSearch> for ::windows::core::IUnknown { fn from(value: &IRTCUserSearch) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCUserSearch { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCUserSearch { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCUserSearch_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppquery: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pquery: ::windows::core::RawPtr, pprofile: ::windows::core::RawPtr, lcookie: isize) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCUserSearchQuery(pub ::windows::core::IUnknown); impl IRTCUserSearchQuery { #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetSearchTerm<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrname: Param0, bstrvalue: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), bstrname.into_param().abi(), bstrvalue.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SearchTerm<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrname: Param0) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrname.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SearchTerms(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } pub unsafe fn SetSearchPreference(&self, enpreference: RTC_USER_SEARCH_PREFERENCE, lvalue: i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(enpreference), ::core::mem::transmute(lvalue)).ok() } pub unsafe fn SearchPreference(&self, enpreference: RTC_USER_SEARCH_PREFERENCE) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(enpreference), &mut result__).from_abi::<i32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetSearchDomain<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdomain: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrdomain.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SearchDomain(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCUserSearchQuery { type Vtable = IRTCUserSearchQuery_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x288300f5_d23a_4365_9a73_9985c98c2881); } impl ::core::convert::From<IRTCUserSearchQuery> for ::windows::core::IUnknown { fn from(value: IRTCUserSearchQuery) -> Self { value.0 } } impl ::core::convert::From<&IRTCUserSearchQuery> for ::windows::core::IUnknown { fn from(value: &IRTCUserSearchQuery) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCUserSearchQuery { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCUserSearchQuery { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCUserSearchQuery_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrvalue: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbstrvalue: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrnames: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enpreference: RTC_USER_SEARCH_PREFERENCE, lvalue: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enpreference: RTC_USER_SEARCH_PREFERENCE, plvalue: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdomain: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdomain: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCUserSearchResult(pub ::windows::core::IUnknown); impl IRTCUserSearchResult { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Value(&self, encolumn: RTC_USER_SEARCH_COLUMN) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(encolumn), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } } unsafe impl ::windows::core::Interface for IRTCUserSearchResult { type Vtable = IRTCUserSearchResult_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x851278b2_9592_480f_8db5_2de86b26b54d); } impl ::core::convert::From<IRTCUserSearchResult> for ::windows::core::IUnknown { fn from(value: IRTCUserSearchResult) -> Self { value.0 } } impl ::core::convert::From<&IRTCUserSearchResult> for ::windows::core::IUnknown { fn from(value: &IRTCUserSearchResult) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCUserSearchResult { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCUserSearchResult { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IRTCUserSearchResult_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, encolumn: RTC_USER_SEARCH_COLUMN, pbstrvalue: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCUserSearchResultsEvent(pub ::windows::core::IUnknown); impl IRTCUserSearchResultsEvent { pub unsafe fn EnumerateResults(&self) -> ::windows::core::Result<IRTCEnumUserSearchResults> { let mut result__: <IRTCEnumUserSearchResults as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCEnumUserSearchResults>(result__) } pub unsafe fn Results(&self) -> ::windows::core::Result<IRTCCollection> { let mut result__: <IRTCCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCCollection>(result__) } pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile2> { let mut result__: <IRTCProfile2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile2>(result__) } pub unsafe fn Query(&self) -> ::windows::core::Result<IRTCUserSearchQuery> { let mut result__: <IRTCUserSearchQuery as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCUserSearchQuery>(result__) } pub unsafe fn Cookie(&self) -> ::windows::core::Result<isize> { let mut result__: <isize as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<isize>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } pub unsafe fn MoreAvailable(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } } unsafe impl ::windows::core::Interface for IRTCUserSearchResultsEvent { type Vtable = IRTCUserSearchResultsEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd8c8c3cd_7fac_4088_81c5_c24cbc0938e3); } impl ::core::convert::From<IRTCUserSearchResultsEvent> for ::windows::core::IUnknown { fn from(value: IRTCUserSearchResultsEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCUserSearchResultsEvent> for ::windows::core::IUnknown { fn from(value: &IRTCUserSearchResultsEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCUserSearchResultsEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCUserSearchResultsEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCUserSearchResultsEvent> for super::Com::IDispatch { fn from(value: IRTCUserSearchResultsEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCUserSearchResultsEvent> for super::Com::IDispatch { fn from(value: &IRTCUserSearchResultsEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCUserSearchResultsEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCUserSearchResultsEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCUserSearchResultsEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppcollection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppquery: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plcookie: *mut isize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfmoreavailable: *mut i16) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCWatcher(pub ::windows::core::IUnknown); impl IRTCWatcher { #[cfg(feature = "Win32_Foundation")] pub unsafe fn PresentityURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPresentityURI<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrname: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), bstrname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Data(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdata: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrdata.into_param().abi()).ok() } pub unsafe fn Persistent(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } pub unsafe fn SetPersistent(&self, fpersistent: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(fpersistent)).ok() } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_WATCHER_STATE> { let mut result__: <RTC_WATCHER_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_WATCHER_STATE>(result__) } pub unsafe fn SetState(&self, enstate: RTC_WATCHER_STATE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(enstate)).ok() } } unsafe impl ::windows::core::Interface for IRTCWatcher { type Vtable = IRTCWatcher_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc7cedad8_346b_4d1b_ac02_a2088df9be4f); } impl ::core::convert::From<IRTCWatcher> for ::windows::core::IUnknown { fn from(value: IRTCWatcher) -> Self { value.0 } } impl ::core::convert::From<&IRTCWatcher> for ::windows::core::IUnknown { fn from(value: &IRTCWatcher) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCWatcher { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCWatcher { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCWatcher> for IRTCPresenceContact { fn from(value: IRTCWatcher) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCWatcher> for IRTCPresenceContact { fn from(value: &IRTCWatcher) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCPresenceContact> for IRTCWatcher { fn into_param(self) -> ::windows::core::Param<'a, IRTCPresenceContact> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCPresenceContact> for &IRTCWatcher { fn into_param(self) -> ::windows::core::Param<'a, IRTCPresenceContact> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCWatcher_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrpresentityuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfpersistent: *mut i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fpersistent: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_WATCHER_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enstate: RTC_WATCHER_STATE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCWatcher2(pub ::windows::core::IUnknown); impl IRTCWatcher2 { #[cfg(feature = "Win32_Foundation")] pub unsafe fn PresentityURI(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetPresentityURI<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrpresentityuri: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrpresentityuri.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrname: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), bstrname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Data(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> { let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrdata: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrdata.into_param().abi()).ok() } pub unsafe fn Persistent(&self) -> ::windows::core::Result<i16> { let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__) } pub unsafe fn SetPersistent(&self, fpersistent: i16) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(fpersistent)).ok() } pub unsafe fn State(&self) -> ::windows::core::Result<RTC_WATCHER_STATE> { let mut result__: <RTC_WATCHER_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_WATCHER_STATE>(result__) } pub unsafe fn SetState(&self, enstate: RTC_WATCHER_STATE) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(enstate)).ok() } pub unsafe fn Profile(&self) -> ::windows::core::Result<IRTCProfile2> { let mut result__: <IRTCProfile2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCProfile2>(result__) } pub unsafe fn Scope(&self) -> ::windows::core::Result<RTC_ACE_SCOPE> { let mut result__: <RTC_ACE_SCOPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_ACE_SCOPE>(result__) } } unsafe impl ::windows::core::Interface for IRTCWatcher2 { type Vtable = IRTCWatcher2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd4d9967f_d011_4b1d_91e3_aba78f96393d); } impl ::core::convert::From<IRTCWatcher2> for ::windows::core::IUnknown { fn from(value: IRTCWatcher2) -> Self { value.0 } } impl ::core::convert::From<&IRTCWatcher2> for ::windows::core::IUnknown { fn from(value: &IRTCWatcher2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCWatcher2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCWatcher2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCWatcher2> for IRTCWatcher { fn from(value: IRTCWatcher2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCWatcher2> for IRTCWatcher { fn from(value: &IRTCWatcher2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCWatcher> for IRTCWatcher2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCWatcher> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCWatcher> for &IRTCWatcher2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCWatcher> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } impl ::core::convert::From<IRTCWatcher2> for IRTCPresenceContact { fn from(value: IRTCWatcher2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCWatcher2> for IRTCPresenceContact { fn from(value: &IRTCWatcher2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCPresenceContact> for IRTCWatcher2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCPresenceContact> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCPresenceContact> for &IRTCWatcher2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCPresenceContact> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCWatcher2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrpresentityuri: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrpresentityuri: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbstrdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrdata: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfpersistent: *mut i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fpersistent: i16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penstate: *mut RTC_WATCHER_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enstate: RTC_WATCHER_STATE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppprofile: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penscope: *mut RTC_ACE_SCOPE) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCWatcherEvent(pub ::windows::core::IUnknown); impl IRTCWatcherEvent { pub unsafe fn Watcher(&self) -> ::windows::core::Result<IRTCWatcher> { let mut result__: <IRTCWatcher as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCWatcher>(result__) } } unsafe impl ::windows::core::Interface for IRTCWatcherEvent { type Vtable = IRTCWatcherEvent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf30d7261_587a_424f_822c_312788f43548); } impl ::core::convert::From<IRTCWatcherEvent> for ::windows::core::IUnknown { fn from(value: IRTCWatcherEvent) -> Self { value.0 } } impl ::core::convert::From<&IRTCWatcherEvent> for ::windows::core::IUnknown { fn from(value: &IRTCWatcherEvent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCWatcherEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCWatcherEvent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCWatcherEvent> for super::Com::IDispatch { fn from(value: IRTCWatcherEvent) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCWatcherEvent> for super::Com::IDispatch { fn from(value: &IRTCWatcherEvent) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCWatcherEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCWatcherEvent { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCWatcherEvent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppwatcher: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IRTCWatcherEvent2(pub ::windows::core::IUnknown); impl IRTCWatcherEvent2 { pub unsafe fn GetTypeInfoCount(&self) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_System_Com")] pub unsafe fn GetTypeInfo(&self, itinfo: u32, lcid: u32) -> ::windows::core::Result<super::Com::ITypeInfo> { let mut result__: <super::Com::ITypeInfo as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(itinfo), ::core::mem::transmute(lcid), &mut result__).from_abi::<super::Com::ITypeInfo>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetIDsOfNames(&self, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(rgsznames), ::core::mem::transmute(cnames), ::core::mem::transmute(lcid), ::core::mem::transmute(rgdispid)).ok() } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe fn Invoke(&self, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut super::Com::VARIANT, pexcepinfo: *mut super::Com::EXCEPINFO, puargerr: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)( ::core::mem::transmute_copy(self), ::core::mem::transmute(dispidmember), ::core::mem::transmute(riid), ::core::mem::transmute(lcid), ::core::mem::transmute(wflags), ::core::mem::transmute(pdispparams), ::core::mem::transmute(pvarresult), ::core::mem::transmute(pexcepinfo), ::core::mem::transmute(puargerr), ) .ok() } pub unsafe fn Watcher(&self) -> ::windows::core::Result<IRTCWatcher> { let mut result__: <IRTCWatcher as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRTCWatcher>(result__) } pub unsafe fn EventType(&self) -> ::windows::core::Result<RTC_WATCHER_EVENT_TYPE> { let mut result__: <RTC_WATCHER_EVENT_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RTC_WATCHER_EVENT_TYPE>(result__) } pub unsafe fn StatusCode(&self) -> ::windows::core::Result<i32> { let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__) } } unsafe impl ::windows::core::Interface for IRTCWatcherEvent2 { type Vtable = IRTCWatcherEvent2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe52891e8_188c_49af_b005_98ed13f83f9c); } impl ::core::convert::From<IRTCWatcherEvent2> for ::windows::core::IUnknown { fn from(value: IRTCWatcherEvent2) -> Self { value.0 } } impl ::core::convert::From<&IRTCWatcherEvent2> for ::windows::core::IUnknown { fn from(value: &IRTCWatcherEvent2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRTCWatcherEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRTCWatcherEvent2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IRTCWatcherEvent2> for IRTCWatcherEvent { fn from(value: IRTCWatcherEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IRTCWatcherEvent2> for IRTCWatcherEvent { fn from(value: &IRTCWatcherEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IRTCWatcherEvent> for IRTCWatcherEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCWatcherEvent> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IRTCWatcherEvent> for &IRTCWatcherEvent2 { fn into_param(self) -> ::windows::core::Param<'a, IRTCWatcherEvent> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<IRTCWatcherEvent2> for super::Com::IDispatch { fn from(value: IRTCWatcherEvent2) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Win32_System_Com")] impl ::core::convert::From<&IRTCWatcherEvent2> for super::Com::IDispatch { fn from(value: &IRTCWatcherEvent2) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRTCWatcherEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Win32_System_Com")] impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRTCWatcherEvent2 { fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IRTCWatcherEvent2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppwatcher: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, peventtype: *mut RTC_WATCHER_EVENT_TYPE) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plstatuscode: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ITransportSettingsInternal(pub ::windows::core::IUnknown); impl ITransportSettingsInternal { #[cfg(feature = "Win32_Networking_WinSock")] pub unsafe fn ApplySetting(&self, setting: *mut TRANSPORT_SETTING) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(setting)).ok() } #[cfg(feature = "Win32_Networking_WinSock")] pub unsafe fn QuerySetting(&self, setting: *mut TRANSPORT_SETTING) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(setting)).ok() } } unsafe impl ::windows::core::Interface for ITransportSettingsInternal { type Vtable = ITransportSettingsInternal_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5123e076_29e3_4bfd_84fe_0192d411e3e8); } impl ::core::convert::From<ITransportSettingsInternal> for ::windows::core::IUnknown { fn from(value: ITransportSettingsInternal) -> Self { value.0 } } impl ::core::convert::From<&ITransportSettingsInternal> for ::windows::core::IUnknown { fn from(value: &ITransportSettingsInternal) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITransportSettingsInternal { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITransportSettingsInternal { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct ITransportSettingsInternal_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, #[cfg(feature = "Win32_Networking_WinSock")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, setting: *mut TRANSPORT_SETTING) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Networking_WinSock"))] usize, #[cfg(feature = "Win32_Networking_WinSock")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, setting: *mut TRANSPORT_SETTING) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Networking_WinSock"))] usize, ); pub const RTCAU_BASIC: u32 = 1u32; pub const RTCAU_DIGEST: u32 = 2u32; pub const RTCAU_KERBEROS: u32 = 8u32; pub const RTCAU_NTLM: u32 = 4u32; pub const RTCAU_USE_LOGON_CRED: u32 = 65536u32; pub const RTCCS_FAIL_ON_REDIRECT: u32 = 2u32; pub const RTCCS_FORCE_PROFILE: u32 = 1u32; pub const RTCClient: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7a42ea29_a2b7_40c4_b091_f6f024aa89be); pub const RTCEF_ALL: u32 = 33554431u32; pub const RTCEF_BUDDY: u32 = 256u32; pub const RTCEF_BUDDY2: u32 = 262144u32; pub const RTCEF_CLIENT: u32 = 1u32; pub const RTCEF_GROUP: u32 = 8192u32; pub const RTCEF_INFO: u32 = 4096u32; pub const RTCEF_INTENSITY: u32 = 64u32; pub const RTCEF_MEDIA: u32 = 32u32; pub const RTCEF_MEDIA_REQUEST: u32 = 16384u32; pub const RTCEF_MESSAGING: u32 = 128u32; pub const RTCEF_PARTICIPANT_STATE_CHANGE: u32 = 16u32; pub const RTCEF_PRESENCE_DATA: u32 = 8388608u32; pub const RTCEF_PRESENCE_PROPERTY: u32 = 131072u32; pub const RTCEF_PRESENCE_STATUS: u32 = 16777216u32; pub const RTCEF_PROFILE: u32 = 1024u32; pub const RTCEF_REGISTRATION_STATE_CHANGE: u32 = 2u32; pub const RTCEF_REINVITE: u32 = 4194304u32; pub const RTCEF_ROAMING: u32 = 65536u32; pub const RTCEF_SESSION_OPERATION_COMPLETE: u32 = 8u32; pub const RTCEF_SESSION_REFERRED: u32 = 2097152u32; pub const RTCEF_SESSION_REFER_STATUS: u32 = 1048576u32; pub const RTCEF_SESSION_STATE_CHANGE: u32 = 4u32; pub const RTCEF_USERSEARCH: u32 = 2048u32; pub const RTCEF_WATCHER: u32 = 512u32; pub const RTCEF_WATCHER2: u32 = 524288u32; pub const RTCIF_DISABLE_MEDIA: u32 = 1u32; pub const RTCIF_DISABLE_STRICT_DNS: u32 = 8u32; pub const RTCIF_DISABLE_UPNP: u32 = 2u32; pub const RTCIF_ENABLE_SERVER_CLASS: u32 = 4u32; pub const RTCMT_AUDIO_RECEIVE: u32 = 2u32; pub const RTCMT_AUDIO_SEND: u32 = 1u32; pub const RTCMT_T120_SENDRECV: u32 = 16u32; pub const RTCMT_VIDEO_RECEIVE: u32 = 8u32; pub const RTCMT_VIDEO_SEND: u32 = 4u32; pub const RTCRF_REGISTER_ALL: u32 = 15u32; pub const RTCRF_REGISTER_INVITE_SESSIONS: u32 = 1u32; pub const RTCRF_REGISTER_MESSAGE_SESSIONS: u32 = 2u32; pub const RTCRF_REGISTER_NOTIFY: u32 = 8u32; pub const RTCRF_REGISTER_PRESENCE: u32 = 4u32; pub const RTCRMF_ALL_ROAMING: u32 = 15u32; pub const RTCRMF_BUDDY_ROAMING: u32 = 1u32; pub const RTCRMF_PRESENCE_ROAMING: u32 = 4u32; pub const RTCRMF_PROFILE_ROAMING: u32 = 8u32; pub const RTCRMF_WATCHER_ROAMING: u32 = 2u32; pub const RTCSI_APPLICATION: u32 = 32u32; pub const RTCSI_IM: u32 = 8u32; pub const RTCSI_MULTIPARTY_IM: u32 = 16u32; pub const RTCSI_PC_TO_PC: u32 = 1u32; pub const RTCSI_PC_TO_PHONE: u32 = 2u32; pub const RTCSI_PHONE_TO_PHONE: u32 = 4u32; pub const RTCTR_TCP: u32 = 2u32; pub const RTCTR_TLS: u32 = 4u32; pub const RTCTR_UDP: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_ACE_SCOPE(pub i32); pub const RTCAS_SCOPE_USER: RTC_ACE_SCOPE = RTC_ACE_SCOPE(0i32); pub const RTCAS_SCOPE_DOMAIN: RTC_ACE_SCOPE = RTC_ACE_SCOPE(1i32); pub const RTCAS_SCOPE_ALL: RTC_ACE_SCOPE = RTC_ACE_SCOPE(2i32); impl ::core::convert::From<i32> for RTC_ACE_SCOPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_ACE_SCOPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_ANSWER_MODE(pub i32); pub const RTCAM_OFFER_SESSION_EVENT: RTC_ANSWER_MODE = RTC_ANSWER_MODE(0i32); pub const RTCAM_AUTOMATICALLY_ACCEPT: RTC_ANSWER_MODE = RTC_ANSWER_MODE(1i32); pub const RTCAM_AUTOMATICALLY_REJECT: RTC_ANSWER_MODE = RTC_ANSWER_MODE(2i32); pub const RTCAM_NOT_SUPPORTED: RTC_ANSWER_MODE = RTC_ANSWER_MODE(3i32); impl ::core::convert::From<i32> for RTC_ANSWER_MODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_ANSWER_MODE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_AUDIO_DEVICE(pub i32); pub const RTCAD_SPEAKER: RTC_AUDIO_DEVICE = RTC_AUDIO_DEVICE(0i32); pub const RTCAD_MICROPHONE: RTC_AUDIO_DEVICE = RTC_AUDIO_DEVICE(1i32); impl ::core::convert::From<i32> for RTC_AUDIO_DEVICE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_AUDIO_DEVICE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_BUDDY_EVENT_TYPE(pub i32); pub const RTCBET_BUDDY_ADD: RTC_BUDDY_EVENT_TYPE = RTC_BUDDY_EVENT_TYPE(0i32); pub const RTCBET_BUDDY_REMOVE: RTC_BUDDY_EVENT_TYPE = RTC_BUDDY_EVENT_TYPE(1i32); pub const RTCBET_BUDDY_UPDATE: RTC_BUDDY_EVENT_TYPE = RTC_BUDDY_EVENT_TYPE(2i32); pub const RTCBET_BUDDY_STATE_CHANGE: RTC_BUDDY_EVENT_TYPE = RTC_BUDDY_EVENT_TYPE(3i32); pub const RTCBET_BUDDY_ROAMED: RTC_BUDDY_EVENT_TYPE = RTC_BUDDY_EVENT_TYPE(4i32); pub const RTCBET_BUDDY_SUBSCRIBED: RTC_BUDDY_EVENT_TYPE = RTC_BUDDY_EVENT_TYPE(5i32); impl ::core::convert::From<i32> for RTC_BUDDY_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_BUDDY_EVENT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_BUDDY_SUBSCRIPTION_TYPE(pub i32); pub const RTCBT_SUBSCRIBED: RTC_BUDDY_SUBSCRIPTION_TYPE = RTC_BUDDY_SUBSCRIPTION_TYPE(0i32); pub const RTCBT_ALWAYS_OFFLINE: RTC_BUDDY_SUBSCRIPTION_TYPE = RTC_BUDDY_SUBSCRIPTION_TYPE(1i32); pub const RTCBT_ALWAYS_ONLINE: RTC_BUDDY_SUBSCRIPTION_TYPE = RTC_BUDDY_SUBSCRIPTION_TYPE(2i32); pub const RTCBT_POLL: RTC_BUDDY_SUBSCRIPTION_TYPE = RTC_BUDDY_SUBSCRIPTION_TYPE(3i32); impl ::core::convert::From<i32> for RTC_BUDDY_SUBSCRIPTION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_BUDDY_SUBSCRIPTION_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_CLIENT_EVENT_TYPE(pub i32); pub const RTCCET_VOLUME_CHANGE: RTC_CLIENT_EVENT_TYPE = RTC_CLIENT_EVENT_TYPE(0i32); pub const RTCCET_DEVICE_CHANGE: RTC_CLIENT_EVENT_TYPE = RTC_CLIENT_EVENT_TYPE(1i32); pub const RTCCET_NETWORK_QUALITY_CHANGE: RTC_CLIENT_EVENT_TYPE = RTC_CLIENT_EVENT_TYPE(2i32); pub const RTCCET_ASYNC_CLEANUP_DONE: RTC_CLIENT_EVENT_TYPE = RTC_CLIENT_EVENT_TYPE(3i32); impl ::core::convert::From<i32> for RTC_CLIENT_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_CLIENT_EVENT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_DTMF(pub i32); pub const RTC_DTMF_0: RTC_DTMF = RTC_DTMF(0i32); pub const RTC_DTMF_1: RTC_DTMF = RTC_DTMF(1i32); pub const RTC_DTMF_2: RTC_DTMF = RTC_DTMF(2i32); pub const RTC_DTMF_3: RTC_DTMF = RTC_DTMF(3i32); pub const RTC_DTMF_4: RTC_DTMF = RTC_DTMF(4i32); pub const RTC_DTMF_5: RTC_DTMF = RTC_DTMF(5i32); pub const RTC_DTMF_6: RTC_DTMF = RTC_DTMF(6i32); pub const RTC_DTMF_7: RTC_DTMF = RTC_DTMF(7i32); pub const RTC_DTMF_8: RTC_DTMF = RTC_DTMF(8i32); pub const RTC_DTMF_9: RTC_DTMF = RTC_DTMF(9i32); pub const RTC_DTMF_STAR: RTC_DTMF = RTC_DTMF(10i32); pub const RTC_DTMF_POUND: RTC_DTMF = RTC_DTMF(11i32); pub const RTC_DTMF_A: RTC_DTMF = RTC_DTMF(12i32); pub const RTC_DTMF_B: RTC_DTMF = RTC_DTMF(13i32); pub const RTC_DTMF_C: RTC_DTMF = RTC_DTMF(14i32); pub const RTC_DTMF_D: RTC_DTMF = RTC_DTMF(15i32); pub const RTC_DTMF_FLASH: RTC_DTMF = RTC_DTMF(16i32); impl ::core::convert::From<i32> for RTC_DTMF { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_DTMF { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_EVENT(pub i32); pub const RTCE_CLIENT: RTC_EVENT = RTC_EVENT(0i32); pub const RTCE_REGISTRATION_STATE_CHANGE: RTC_EVENT = RTC_EVENT(1i32); pub const RTCE_SESSION_STATE_CHANGE: RTC_EVENT = RTC_EVENT(2i32); pub const RTCE_SESSION_OPERATION_COMPLETE: RTC_EVENT = RTC_EVENT(3i32); pub const RTCE_PARTICIPANT_STATE_CHANGE: RTC_EVENT = RTC_EVENT(4i32); pub const RTCE_MEDIA: RTC_EVENT = RTC_EVENT(5i32); pub const RTCE_INTENSITY: RTC_EVENT = RTC_EVENT(6i32); pub const RTCE_MESSAGING: RTC_EVENT = RTC_EVENT(7i32); pub const RTCE_BUDDY: RTC_EVENT = RTC_EVENT(8i32); pub const RTCE_WATCHER: RTC_EVENT = RTC_EVENT(9i32); pub const RTCE_PROFILE: RTC_EVENT = RTC_EVENT(10i32); pub const RTCE_USERSEARCH: RTC_EVENT = RTC_EVENT(11i32); pub const RTCE_INFO: RTC_EVENT = RTC_EVENT(12i32); pub const RTCE_GROUP: RTC_EVENT = RTC_EVENT(13i32); pub const RTCE_MEDIA_REQUEST: RTC_EVENT = RTC_EVENT(14i32); pub const RTCE_ROAMING: RTC_EVENT = RTC_EVENT(15i32); pub const RTCE_PRESENCE_PROPERTY: RTC_EVENT = RTC_EVENT(16i32); pub const RTCE_PRESENCE_DATA: RTC_EVENT = RTC_EVENT(17i32); pub const RTCE_PRESENCE_STATUS: RTC_EVENT = RTC_EVENT(18i32); pub const RTCE_SESSION_REFER_STATUS: RTC_EVENT = RTC_EVENT(19i32); pub const RTCE_SESSION_REFERRED: RTC_EVENT = RTC_EVENT(20i32); pub const RTCE_REINVITE: RTC_EVENT = RTC_EVENT(21i32); impl ::core::convert::From<i32> for RTC_EVENT { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_EVENT { type Abi = Self; } pub const RTC_E_ANOTHER_MEDIA_SESSION_ACTIVE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885961i32 as _); pub const RTC_E_BASIC_AUTH_SET_TLS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886017i32 as _); pub const RTC_E_CLIENT_ALREADY_INITIALIZED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886042i32 as _); pub const RTC_E_CLIENT_ALREADY_SHUT_DOWN: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886041i32 as _); pub const RTC_E_CLIENT_NOT_INITIALIZED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886043i32 as _); pub const RTC_E_DESTINATION_ADDRESS_LOCAL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886061i32 as _); pub const RTC_E_DESTINATION_ADDRESS_MULTICAST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886059i32 as _); pub const RTC_E_DUPLICATE_BUDDY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886006i32 as _); pub const RTC_E_DUPLICATE_GROUP: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885998i32 as _); pub const RTC_E_DUPLICATE_REALM: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886013i32 as _); pub const RTC_E_DUPLICATE_WATCHER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886005i32 as _); pub const RTC_E_INVALID_ACL_LIST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886000i32 as _); pub const RTC_E_INVALID_ADDRESS_LOCAL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886060i32 as _); pub const RTC_E_INVALID_BUDDY_LIST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886001i32 as _); pub const RTC_E_INVALID_LISTEN_SOCKET: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885957i32 as _); pub const RTC_E_INVALID_OBJECT_STATE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885983i32 as _); pub const RTC_E_INVALID_PORTRANGE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885988i32 as _); pub const RTC_E_INVALID_PREFERENCE_LIST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885991i32 as _); pub const RTC_E_INVALID_PROFILE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886034i32 as _); pub const RTC_E_INVALID_PROXY_ADDRESS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886058i32 as _); pub const RTC_E_INVALID_REGISTRATION_STATE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885971i32 as _); pub const RTC_E_INVALID_SESSION_STATE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886038i32 as _); pub const RTC_E_INVALID_SESSION_TYPE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886039i32 as _); pub const RTC_E_INVALID_SIP_URL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886062i32 as _); pub const RTC_E_LISTENING_SOCKET_NOT_EXIST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885958i32 as _); pub const RTC_E_LOCAL_PHONE_NEEDED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886036i32 as _); pub const RTC_E_MALFORMED_XML: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886004i32 as _); pub const RTC_E_MAX_PENDING_OPERATIONS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885990i32 as _); pub const RTC_E_MAX_REDIRECTS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885960i32 as _); pub const RTC_E_MEDIA_AEC: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886044i32 as _); pub const RTC_E_MEDIA_AUDIO_DEVICE_NOT_AVAILABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886047i32 as _); pub const RTC_E_MEDIA_CONTROLLER_STATE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886049i32 as _); pub const RTC_E_MEDIA_DISABLED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885970i32 as _); pub const RTC_E_MEDIA_ENABLED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885969i32 as _); pub const RTC_E_MEDIA_NEED_TERMINAL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886048i32 as _); pub const RTC_E_MEDIA_SESSION_IN_HOLD: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885962i32 as _); pub const RTC_E_MEDIA_SESSION_NOT_EXIST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885963i32 as _); pub const RTC_E_MEDIA_VIDEO_DEVICE_NOT_AVAILABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886046i32 as _); pub const RTC_E_NOT_ALLOWED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885950i32 as _); pub const RTC_E_NOT_EXIST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885992i32 as _); pub const RTC_E_NOT_PRESENCE_PROFILE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885974i32 as _); pub const RTC_E_NO_BUDDY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885996i32 as _); pub const RTC_E_NO_DEVICE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886035i32 as _); pub const RTC_E_NO_GROUP: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885999i32 as _); pub const RTC_E_NO_PROFILE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886037i32 as _); pub const RTC_E_NO_REALM: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885994i32 as _); pub const RTC_E_NO_TRANSPORT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885993i32 as _); pub const RTC_E_NO_WATCHER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885995i32 as _); pub const RTC_E_OPERATION_WITH_TOO_MANY_PARTICIPANTS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886018i32 as _); pub const RTC_E_PINT_STATUS_REJECTED_ALL_BUSY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131755001i32 as _); pub const RTC_E_PINT_STATUS_REJECTED_BADNUMBER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131754997i32 as _); pub const RTC_E_PINT_STATUS_REJECTED_BUSY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131755003i32 as _); pub const RTC_E_PINT_STATUS_REJECTED_CANCELLED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131754998i32 as _); pub const RTC_E_PINT_STATUS_REJECTED_NO_ANSWER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131755002i32 as _); pub const RTC_E_PINT_STATUS_REJECTED_PL_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131755000i32 as _); pub const RTC_E_PINT_STATUS_REJECTED_SW_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131754999i32 as _); pub const RTC_E_PLATFORM_NOT_SUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885952i32 as _); pub const RTC_E_POLICY_NOT_ALLOW: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886012i32 as _); pub const RTC_E_PORT_MANAGER_ALREADY_SET: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885956i32 as _); pub const RTC_E_PORT_MAPPING_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886010i32 as _); pub const RTC_E_PORT_MAPPING_UNAVAILABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886011i32 as _); pub const RTC_E_PRESENCE_ENABLED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885982i32 as _); pub const RTC_E_PRESENCE_NOT_ENABLED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886040i32 as _); pub const RTC_E_PROFILE_INVALID_SERVER_AUTHMETHOD: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886024i32 as _); pub const RTC_E_PROFILE_INVALID_SERVER_PROTOCOL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886025i32 as _); pub const RTC_E_PROFILE_INVALID_SERVER_ROLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886023i32 as _); pub const RTC_E_PROFILE_INVALID_SESSION: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886021i32 as _); pub const RTC_E_PROFILE_INVALID_SESSION_PARTY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886020i32 as _); pub const RTC_E_PROFILE_INVALID_SESSION_TYPE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886019i32 as _); pub const RTC_E_PROFILE_MULTIPLE_REGISTRARS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886022i32 as _); pub const RTC_E_PROFILE_NO_KEY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886032i32 as _); pub const RTC_E_PROFILE_NO_NAME: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886031i32 as _); pub const RTC_E_PROFILE_NO_PROVISION: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886033i32 as _); pub const RTC_E_PROFILE_NO_SERVER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886028i32 as _); pub const RTC_E_PROFILE_NO_SERVER_ADDRESS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886027i32 as _); pub const RTC_E_PROFILE_NO_SERVER_PROTOCOL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886026i32 as _); pub const RTC_E_PROFILE_NO_USER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886030i32 as _); pub const RTC_E_PROFILE_NO_USER_URI: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886029i32 as _); pub const RTC_E_PROFILE_SERVER_UNAUTHORIZED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886014i32 as _); pub const RTC_E_REDIRECT_PROCESSING_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885959i32 as _); pub const RTC_E_REFER_NOT_ACCEPTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885968i32 as _); pub const RTC_E_REFER_NOT_ALLOWED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885967i32 as _); pub const RTC_E_REFER_NOT_EXIST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885966i32 as _); pub const RTC_E_REGISTRATION_DEACTIVATED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885949i32 as _); pub const RTC_E_REGISTRATION_REJECTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885948i32 as _); pub const RTC_E_REGISTRATION_UNREGISTERED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885947i32 as _); pub const RTC_E_ROAMING_ENABLED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885981i32 as _); pub const RTC_E_ROAMING_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886002i32 as _); pub const RTC_E_ROAMING_OPERATION_INTERRUPTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886003i32 as _); pub const RTC_E_SDP_CONNECTION_ADDR: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886070i32 as _); pub const RTC_E_SDP_FAILED_TO_BUILD: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886067i32 as _); pub const RTC_E_SDP_MULTICAST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886071i32 as _); pub const RTC_E_SDP_NOT_PRESENT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886074i32 as _); pub const RTC_E_SDP_NO_MEDIA: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886069i32 as _); pub const RTC_E_SDP_PARSE_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886073i32 as _); pub const RTC_E_SDP_UPDATE_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886072i32 as _); pub const RTC_E_SECURITY_LEVEL_ALREADY_SET: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885955i32 as _); pub const RTC_E_SECURITY_LEVEL_NOT_COMPATIBLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886009i32 as _); pub const RTC_E_SECURITY_LEVEL_NOT_DEFINED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886008i32 as _); pub const RTC_E_SECURITY_LEVEL_NOT_SUPPORTED_BY_PARTICIPANT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886007i32 as _); pub const RTC_E_SIP_ADDITIONAL_PARTY_IN_TWO_PARTY_SESSION: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885986i32 as _); pub const RTC_E_SIP_AUTH_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886063i32 as _); pub const RTC_E_SIP_AUTH_HEADER_SENT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886065i32 as _); pub const RTC_E_SIP_AUTH_TIME_SKEW: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885972i32 as _); pub const RTC_E_SIP_AUTH_TYPE_NOT_SUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886064i32 as _); pub const RTC_E_SIP_CALL_CONNECTION_NOT_ESTABLISHED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885987i32 as _); pub const RTC_E_SIP_CALL_DISCONNECTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886055i32 as _); pub const RTC_E_SIP_CODECS_DO_NOT_MATCH: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886080i32 as _); pub const RTC_E_SIP_DNS_FAIL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885978i32 as _); pub const RTC_E_SIP_HEADER_NOT_PRESENT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886075i32 as _); pub const RTC_E_SIP_HIGH_SECURITY_SET_TLS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886016i32 as _); pub const RTC_E_SIP_HOLD_OPERATION_PENDING: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885965i32 as _); pub const RTC_E_SIP_INVALID_CERTIFICATE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885979i32 as _); pub const RTC_E_SIP_INVITEE_PARTY_TIMEOUT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885973i32 as _); pub const RTC_E_SIP_INVITE_TRANSACTION_PENDING: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886066i32 as _); pub const RTC_E_SIP_NEED_MORE_DATA: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886056i32 as _); pub const RTC_E_SIP_NO_STREAM: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886077i32 as _); pub const RTC_E_SIP_OTHER_PARTY_JOIN_IN_PROGRESS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885984i32 as _); pub const RTC_E_SIP_PARSE_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886076i32 as _); pub const RTC_E_SIP_PARTY_ALREADY_IN_SESSION: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885985i32 as _); pub const RTC_E_SIP_PEER_PARTICIPANT_IN_MULTIPARTY_SESSION: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885951i32 as _); pub const RTC_E_SIP_REFER_OPERATION_PENDING: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885953i32 as _); pub const RTC_E_SIP_REQUEST_DESTINATION_ADDR_NOT_PRESENT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886054i32 as _); pub const RTC_E_SIP_SSL_NEGOTIATION_TIMEOUT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886051i32 as _); pub const RTC_E_SIP_SSL_TUNNEL_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886052i32 as _); pub const RTC_E_SIP_STACK_SHUTDOWN: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886050i32 as _); pub const RTC_E_SIP_STREAM_NOT_PRESENT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886078i32 as _); pub const RTC_E_SIP_STREAM_PRESENT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886079i32 as _); pub const RTC_E_SIP_TCP_FAIL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885977i32 as _); pub const RTC_E_SIP_TIMEOUT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886068i32 as _); pub const RTC_E_SIP_TLS_FAIL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885975i32 as _); pub const RTC_E_SIP_TLS_INCOMPATIBLE_ENCRYPTION: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885980i32 as _); pub const RTC_E_SIP_TRANSPORT_NOT_SUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886057i32 as _); pub const RTC_E_SIP_UDP_SIZE_EXCEEDED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886053i32 as _); pub const RTC_E_SIP_UNHOLD_OPERATION_PENDING: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885964i32 as _); pub const RTC_E_START_STREAM: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131886045i32 as _); pub const RTC_E_STATUS_CLIENT_ADDRESS_INCOMPLETE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820060i32 as _); pub const RTC_E_STATUS_CLIENT_AMBIGUOUS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820059i32 as _); pub const RTC_E_STATUS_CLIENT_BAD_EXTENSION: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820124i32 as _); pub const RTC_E_STATUS_CLIENT_BAD_REQUEST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820144i32 as _); pub const RTC_E_STATUS_CLIENT_BUSY_HERE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820058i32 as _); pub const RTC_E_STATUS_CLIENT_CONFLICT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820135i32 as _); pub const RTC_E_STATUS_CLIENT_FORBIDDEN: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820141i32 as _); pub const RTC_E_STATUS_CLIENT_GONE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820134i32 as _); pub const RTC_E_STATUS_CLIENT_LENGTH_REQUIRED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820133i32 as _); pub const RTC_E_STATUS_CLIENT_LOOP_DETECTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820062i32 as _); pub const RTC_E_STATUS_CLIENT_METHOD_NOT_ALLOWED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820139i32 as _); pub const RTC_E_STATUS_CLIENT_NOT_ACCEPTABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820138i32 as _); pub const RTC_E_STATUS_CLIENT_NOT_FOUND: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820140i32 as _); pub const RTC_E_STATUS_CLIENT_PAYMENT_REQUIRED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820142i32 as _); pub const RTC_E_STATUS_CLIENT_PROXY_AUTHENTICATION_REQUIRED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820137i32 as _); pub const RTC_E_STATUS_CLIENT_REQUEST_ENTITY_TOO_LARGE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820131i32 as _); pub const RTC_E_STATUS_CLIENT_REQUEST_TIMEOUT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820136i32 as _); pub const RTC_E_STATUS_CLIENT_REQUEST_URI_TOO_LARGE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820130i32 as _); pub const RTC_E_STATUS_CLIENT_TEMPORARILY_NOT_AVAILABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820064i32 as _); pub const RTC_E_STATUS_CLIENT_TOO_MANY_HOPS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820061i32 as _); pub const RTC_E_STATUS_CLIENT_TRANSACTION_DOES_NOT_EXIST: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820063i32 as _); pub const RTC_E_STATUS_CLIENT_UNAUTHORIZED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820143i32 as _); pub const RTC_E_STATUS_CLIENT_UNSUPPORTED_MEDIA_TYPE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820129i32 as _); pub const RTC_E_STATUS_GLOBAL_BUSY_EVERYWHERE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131819944i32 as _); pub const RTC_E_STATUS_GLOBAL_DECLINE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131819941i32 as _); pub const RTC_E_STATUS_GLOBAL_DOES_NOT_EXIST_ANYWHERE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131819940i32 as _); pub const RTC_E_STATUS_GLOBAL_NOT_ACCEPTABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131819938i32 as _); pub const RTC_E_STATUS_INFO_CALL_FORWARDING: ::windows::core::HRESULT = ::windows::core::HRESULT(15663285i32 as _); pub const RTC_E_STATUS_INFO_QUEUED: ::windows::core::HRESULT = ::windows::core::HRESULT(15663286i32 as _); pub const RTC_E_STATUS_INFO_RINGING: ::windows::core::HRESULT = ::windows::core::HRESULT(15663284i32 as _); pub const RTC_E_STATUS_INFO_TRYING: ::windows::core::HRESULT = ::windows::core::HRESULT(15663204i32 as _); pub const RTC_E_STATUS_NOT_ACCEPTABLE_HERE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820056i32 as _); pub const RTC_E_STATUS_REDIRECT_ALTERNATIVE_SERVICE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820164i32 as _); pub const RTC_E_STATUS_REDIRECT_MOVED_PERMANENTLY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820243i32 as _); pub const RTC_E_STATUS_REDIRECT_MOVED_TEMPORARILY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820242i32 as _); pub const RTC_E_STATUS_REDIRECT_MULTIPLE_CHOICES: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820244i32 as _); pub const RTC_E_STATUS_REDIRECT_SEE_OTHER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820241i32 as _); pub const RTC_E_STATUS_REDIRECT_USE_PROXY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820239i32 as _); pub const RTC_E_STATUS_REQUEST_TERMINATED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820057i32 as _); pub const RTC_E_STATUS_SERVER_BAD_GATEWAY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820042i32 as _); pub const RTC_E_STATUS_SERVER_INTERNAL_ERROR: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820044i32 as _); pub const RTC_E_STATUS_SERVER_NOT_IMPLEMENTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820043i32 as _); pub const RTC_E_STATUS_SERVER_SERVER_TIMEOUT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820040i32 as _); pub const RTC_E_STATUS_SERVER_SERVICE_UNAVAILABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820041i32 as _); pub const RTC_E_STATUS_SERVER_VERSION_NOT_SUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131820039i32 as _); pub const RTC_E_STATUS_SESSION_PROGRESS: ::windows::core::HRESULT = ::windows::core::HRESULT(15663287i32 as _); pub const RTC_E_STATUS_SUCCESS: ::windows::core::HRESULT = ::windows::core::HRESULT(15663304i32 as _); pub const RTC_E_TOO_MANY_GROUPS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885997i32 as _); pub const RTC_E_TOO_MANY_RETRIES: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885989i32 as _); pub const RTC_E_TOO_SMALL_EXPIRES_VALUE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885976i32 as _); pub const RTC_E_UDP_NOT_SUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2131885954i32 as _); #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_GROUP_EVENT_TYPE(pub i32); pub const RTCGET_GROUP_ADD: RTC_GROUP_EVENT_TYPE = RTC_GROUP_EVENT_TYPE(0i32); pub const RTCGET_GROUP_REMOVE: RTC_GROUP_EVENT_TYPE = RTC_GROUP_EVENT_TYPE(1i32); pub const RTCGET_GROUP_UPDATE: RTC_GROUP_EVENT_TYPE = RTC_GROUP_EVENT_TYPE(2i32); pub const RTCGET_GROUP_BUDDY_ADD: RTC_GROUP_EVENT_TYPE = RTC_GROUP_EVENT_TYPE(3i32); pub const RTCGET_GROUP_BUDDY_REMOVE: RTC_GROUP_EVENT_TYPE = RTC_GROUP_EVENT_TYPE(4i32); pub const RTCGET_GROUP_ROAMED: RTC_GROUP_EVENT_TYPE = RTC_GROUP_EVENT_TYPE(5i32); impl ::core::convert::From<i32> for RTC_GROUP_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_GROUP_EVENT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_LISTEN_MODE(pub i32); pub const RTCLM_NONE: RTC_LISTEN_MODE = RTC_LISTEN_MODE(0i32); pub const RTCLM_DYNAMIC: RTC_LISTEN_MODE = RTC_LISTEN_MODE(1i32); pub const RTCLM_BOTH: RTC_LISTEN_MODE = RTC_LISTEN_MODE(2i32); impl ::core::convert::From<i32> for RTC_LISTEN_MODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_LISTEN_MODE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_MEDIA_EVENT_REASON(pub i32); pub const RTCMER_NORMAL: RTC_MEDIA_EVENT_REASON = RTC_MEDIA_EVENT_REASON(0i32); pub const RTCMER_HOLD: RTC_MEDIA_EVENT_REASON = RTC_MEDIA_EVENT_REASON(1i32); pub const RTCMER_TIMEOUT: RTC_MEDIA_EVENT_REASON = RTC_MEDIA_EVENT_REASON(2i32); pub const RTCMER_BAD_DEVICE: RTC_MEDIA_EVENT_REASON = RTC_MEDIA_EVENT_REASON(3i32); pub const RTCMER_NO_PORT: RTC_MEDIA_EVENT_REASON = RTC_MEDIA_EVENT_REASON(4i32); pub const RTCMER_PORT_MAPPING_FAILED: RTC_MEDIA_EVENT_REASON = RTC_MEDIA_EVENT_REASON(5i32); pub const RTCMER_REMOTE_REQUEST: RTC_MEDIA_EVENT_REASON = RTC_MEDIA_EVENT_REASON(6i32); impl ::core::convert::From<i32> for RTC_MEDIA_EVENT_REASON { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_MEDIA_EVENT_REASON { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_MEDIA_EVENT_TYPE(pub i32); pub const RTCMET_STOPPED: RTC_MEDIA_EVENT_TYPE = RTC_MEDIA_EVENT_TYPE(0i32); pub const RTCMET_STARTED: RTC_MEDIA_EVENT_TYPE = RTC_MEDIA_EVENT_TYPE(1i32); pub const RTCMET_FAILED: RTC_MEDIA_EVENT_TYPE = RTC_MEDIA_EVENT_TYPE(2i32); impl ::core::convert::From<i32> for RTC_MEDIA_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_MEDIA_EVENT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_MESSAGING_EVENT_TYPE(pub i32); pub const RTCMSET_MESSAGE: RTC_MESSAGING_EVENT_TYPE = RTC_MESSAGING_EVENT_TYPE(0i32); pub const RTCMSET_STATUS: RTC_MESSAGING_EVENT_TYPE = RTC_MESSAGING_EVENT_TYPE(1i32); impl ::core::convert::From<i32> for RTC_MESSAGING_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_MESSAGING_EVENT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_MESSAGING_USER_STATUS(pub i32); pub const RTCMUS_IDLE: RTC_MESSAGING_USER_STATUS = RTC_MESSAGING_USER_STATUS(0i32); pub const RTCMUS_TYPING: RTC_MESSAGING_USER_STATUS = RTC_MESSAGING_USER_STATUS(1i32); impl ::core::convert::From<i32> for RTC_MESSAGING_USER_STATUS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_MESSAGING_USER_STATUS { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_OFFER_WATCHER_MODE(pub i32); pub const RTCOWM_OFFER_WATCHER_EVENT: RTC_OFFER_WATCHER_MODE = RTC_OFFER_WATCHER_MODE(0i32); pub const RTCOWM_AUTOMATICALLY_ADD_WATCHER: RTC_OFFER_WATCHER_MODE = RTC_OFFER_WATCHER_MODE(1i32); impl ::core::convert::From<i32> for RTC_OFFER_WATCHER_MODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_OFFER_WATCHER_MODE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_PARTICIPANT_STATE(pub i32); pub const RTCPS_IDLE: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(0i32); pub const RTCPS_PENDING: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(1i32); pub const RTCPS_INCOMING: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(2i32); pub const RTCPS_ANSWERING: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(3i32); pub const RTCPS_INPROGRESS: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(4i32); pub const RTCPS_ALERTING: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(5i32); pub const RTCPS_CONNECTED: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(6i32); pub const RTCPS_DISCONNECTING: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(7i32); pub const RTCPS_DISCONNECTED: RTC_PARTICIPANT_STATE = RTC_PARTICIPANT_STATE(8i32); impl ::core::convert::From<i32> for RTC_PARTICIPANT_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_PARTICIPANT_STATE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_PORT_TYPE(pub i32); pub const RTCPT_AUDIO_RTP: RTC_PORT_TYPE = RTC_PORT_TYPE(0i32); pub const RTCPT_AUDIO_RTCP: RTC_PORT_TYPE = RTC_PORT_TYPE(1i32); pub const RTCPT_VIDEO_RTP: RTC_PORT_TYPE = RTC_PORT_TYPE(2i32); pub const RTCPT_VIDEO_RTCP: RTC_PORT_TYPE = RTC_PORT_TYPE(3i32); pub const RTCPT_SIP: RTC_PORT_TYPE = RTC_PORT_TYPE(4i32); impl ::core::convert::From<i32> for RTC_PORT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_PORT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_PRESENCE_PROPERTY(pub i32); pub const RTCPP_PHONENUMBER: RTC_PRESENCE_PROPERTY = RTC_PRESENCE_PROPERTY(0i32); pub const RTCPP_DISPLAYNAME: RTC_PRESENCE_PROPERTY = RTC_PRESENCE_PROPERTY(1i32); pub const RTCPP_EMAIL: RTC_PRESENCE_PROPERTY = RTC_PRESENCE_PROPERTY(2i32); pub const RTCPP_DEVICE_NAME: RTC_PRESENCE_PROPERTY = RTC_PRESENCE_PROPERTY(3i32); pub const RTCPP_MULTIPLE: RTC_PRESENCE_PROPERTY = RTC_PRESENCE_PROPERTY(4i32); impl ::core::convert::From<i32> for RTC_PRESENCE_PROPERTY { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_PRESENCE_PROPERTY { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_PRESENCE_STATUS(pub i32); pub const RTCXS_PRESENCE_OFFLINE: RTC_PRESENCE_STATUS = RTC_PRESENCE_STATUS(0i32); pub const RTCXS_PRESENCE_ONLINE: RTC_PRESENCE_STATUS = RTC_PRESENCE_STATUS(1i32); pub const RTCXS_PRESENCE_AWAY: RTC_PRESENCE_STATUS = RTC_PRESENCE_STATUS(2i32); pub const RTCXS_PRESENCE_IDLE: RTC_PRESENCE_STATUS = RTC_PRESENCE_STATUS(3i32); pub const RTCXS_PRESENCE_BUSY: RTC_PRESENCE_STATUS = RTC_PRESENCE_STATUS(4i32); pub const RTCXS_PRESENCE_BE_RIGHT_BACK: RTC_PRESENCE_STATUS = RTC_PRESENCE_STATUS(5i32); pub const RTCXS_PRESENCE_ON_THE_PHONE: RTC_PRESENCE_STATUS = RTC_PRESENCE_STATUS(6i32); pub const RTCXS_PRESENCE_OUT_TO_LUNCH: RTC_PRESENCE_STATUS = RTC_PRESENCE_STATUS(7i32); impl ::core::convert::From<i32> for RTC_PRESENCE_STATUS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_PRESENCE_STATUS { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_PRIVACY_MODE(pub i32); pub const RTCPM_BLOCK_LIST_EXCLUDED: RTC_PRIVACY_MODE = RTC_PRIVACY_MODE(0i32); pub const RTCPM_ALLOW_LIST_ONLY: RTC_PRIVACY_MODE = RTC_PRIVACY_MODE(1i32); impl ::core::convert::From<i32> for RTC_PRIVACY_MODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_PRIVACY_MODE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_PROFILE_EVENT_TYPE(pub i32); pub const RTCPFET_PROFILE_GET: RTC_PROFILE_EVENT_TYPE = RTC_PROFILE_EVENT_TYPE(0i32); pub const RTCPFET_PROFILE_UPDATE: RTC_PROFILE_EVENT_TYPE = RTC_PROFILE_EVENT_TYPE(1i32); impl ::core::convert::From<i32> for RTC_PROFILE_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_PROFILE_EVENT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_PROVIDER_URI(pub i32); pub const RTCPU_URIHOMEPAGE: RTC_PROVIDER_URI = RTC_PROVIDER_URI(0i32); pub const RTCPU_URIHELPDESK: RTC_PROVIDER_URI = RTC_PROVIDER_URI(1i32); pub const RTCPU_URIPERSONALACCOUNT: RTC_PROVIDER_URI = RTC_PROVIDER_URI(2i32); pub const RTCPU_URIDISPLAYDURINGCALL: RTC_PROVIDER_URI = RTC_PROVIDER_URI(3i32); pub const RTCPU_URIDISPLAYDURINGIDLE: RTC_PROVIDER_URI = RTC_PROVIDER_URI(4i32); impl ::core::convert::From<i32> for RTC_PROVIDER_URI { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_PROVIDER_URI { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_REGISTRATION_STATE(pub i32); pub const RTCRS_NOT_REGISTERED: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(0i32); pub const RTCRS_REGISTERING: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(1i32); pub const RTCRS_REGISTERED: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(2i32); pub const RTCRS_REJECTED: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(3i32); pub const RTCRS_UNREGISTERING: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(4i32); pub const RTCRS_ERROR: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(5i32); pub const RTCRS_LOGGED_OFF: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(6i32); pub const RTCRS_LOCAL_PA_LOGGED_OFF: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(7i32); pub const RTCRS_REMOTE_PA_LOGGED_OFF: RTC_REGISTRATION_STATE = RTC_REGISTRATION_STATE(8i32); impl ::core::convert::From<i32> for RTC_REGISTRATION_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_REGISTRATION_STATE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_REINVITE_STATE(pub i32); pub const RTCRIN_INCOMING: RTC_REINVITE_STATE = RTC_REINVITE_STATE(0i32); pub const RTCRIN_SUCCEEDED: RTC_REINVITE_STATE = RTC_REINVITE_STATE(1i32); pub const RTCRIN_FAIL: RTC_REINVITE_STATE = RTC_REINVITE_STATE(2i32); impl ::core::convert::From<i32> for RTC_REINVITE_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_REINVITE_STATE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_RING_TYPE(pub i32); pub const RTCRT_PHONE: RTC_RING_TYPE = RTC_RING_TYPE(0i32); pub const RTCRT_MESSAGE: RTC_RING_TYPE = RTC_RING_TYPE(1i32); pub const RTCRT_RINGBACK: RTC_RING_TYPE = RTC_RING_TYPE(2i32); impl ::core::convert::From<i32> for RTC_RING_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_RING_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_ROAMING_EVENT_TYPE(pub i32); pub const RTCRET_BUDDY_ROAMING: RTC_ROAMING_EVENT_TYPE = RTC_ROAMING_EVENT_TYPE(0i32); pub const RTCRET_WATCHER_ROAMING: RTC_ROAMING_EVENT_TYPE = RTC_ROAMING_EVENT_TYPE(1i32); pub const RTCRET_PRESENCE_ROAMING: RTC_ROAMING_EVENT_TYPE = RTC_ROAMING_EVENT_TYPE(2i32); pub const RTCRET_PROFILE_ROAMING: RTC_ROAMING_EVENT_TYPE = RTC_ROAMING_EVENT_TYPE(3i32); pub const RTCRET_WPENDING_ROAMING: RTC_ROAMING_EVENT_TYPE = RTC_ROAMING_EVENT_TYPE(4i32); impl ::core::convert::From<i32> for RTC_ROAMING_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_ROAMING_EVENT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_SECURITY_LEVEL(pub i32); pub const RTCSECL_UNSUPPORTED: RTC_SECURITY_LEVEL = RTC_SECURITY_LEVEL(1i32); pub const RTCSECL_SUPPORTED: RTC_SECURITY_LEVEL = RTC_SECURITY_LEVEL(2i32); pub const RTCSECL_REQUIRED: RTC_SECURITY_LEVEL = RTC_SECURITY_LEVEL(3i32); impl ::core::convert::From<i32> for RTC_SECURITY_LEVEL { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_SECURITY_LEVEL { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_SECURITY_TYPE(pub i32); pub const RTCSECT_AUDIO_VIDEO_MEDIA_ENCRYPTION: RTC_SECURITY_TYPE = RTC_SECURITY_TYPE(0i32); pub const RTCSECT_T120_MEDIA_ENCRYPTION: RTC_SECURITY_TYPE = RTC_SECURITY_TYPE(1i32); impl ::core::convert::From<i32> for RTC_SECURITY_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_SECURITY_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_SESSION_REFER_STATUS(pub i32); pub const RTCSRS_REFERRING: RTC_SESSION_REFER_STATUS = RTC_SESSION_REFER_STATUS(0i32); pub const RTCSRS_ACCEPTED: RTC_SESSION_REFER_STATUS = RTC_SESSION_REFER_STATUS(1i32); pub const RTCSRS_ERROR: RTC_SESSION_REFER_STATUS = RTC_SESSION_REFER_STATUS(2i32); pub const RTCSRS_REJECTED: RTC_SESSION_REFER_STATUS = RTC_SESSION_REFER_STATUS(3i32); pub const RTCSRS_DROPPED: RTC_SESSION_REFER_STATUS = RTC_SESSION_REFER_STATUS(4i32); pub const RTCSRS_DONE: RTC_SESSION_REFER_STATUS = RTC_SESSION_REFER_STATUS(5i32); impl ::core::convert::From<i32> for RTC_SESSION_REFER_STATUS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_SESSION_REFER_STATUS { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_SESSION_STATE(pub i32); pub const RTCSS_IDLE: RTC_SESSION_STATE = RTC_SESSION_STATE(0i32); pub const RTCSS_INCOMING: RTC_SESSION_STATE = RTC_SESSION_STATE(1i32); pub const RTCSS_ANSWERING: RTC_SESSION_STATE = RTC_SESSION_STATE(2i32); pub const RTCSS_INPROGRESS: RTC_SESSION_STATE = RTC_SESSION_STATE(3i32); pub const RTCSS_CONNECTED: RTC_SESSION_STATE = RTC_SESSION_STATE(4i32); pub const RTCSS_DISCONNECTED: RTC_SESSION_STATE = RTC_SESSION_STATE(5i32); pub const RTCSS_HOLD: RTC_SESSION_STATE = RTC_SESSION_STATE(6i32); pub const RTCSS_REFER: RTC_SESSION_STATE = RTC_SESSION_STATE(7i32); impl ::core::convert::From<i32> for RTC_SESSION_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_SESSION_STATE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_SESSION_TYPE(pub i32); pub const RTCST_PC_TO_PC: RTC_SESSION_TYPE = RTC_SESSION_TYPE(0i32); pub const RTCST_PC_TO_PHONE: RTC_SESSION_TYPE = RTC_SESSION_TYPE(1i32); pub const RTCST_PHONE_TO_PHONE: RTC_SESSION_TYPE = RTC_SESSION_TYPE(2i32); pub const RTCST_IM: RTC_SESSION_TYPE = RTC_SESSION_TYPE(3i32); pub const RTCST_MULTIPARTY_IM: RTC_SESSION_TYPE = RTC_SESSION_TYPE(4i32); pub const RTCST_APPLICATION: RTC_SESSION_TYPE = RTC_SESSION_TYPE(5i32); impl ::core::convert::From<i32> for RTC_SESSION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_SESSION_TYPE { type Abi = Self; } pub const RTC_S_ROAMING_NOT_SUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(15597633i32 as _); #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_T120_APPLET(pub i32); pub const RTCTA_WHITEBOARD: RTC_T120_APPLET = RTC_T120_APPLET(0i32); pub const RTCTA_APPSHARING: RTC_T120_APPLET = RTC_T120_APPLET(1i32); impl ::core::convert::From<i32> for RTC_T120_APPLET { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_T120_APPLET { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_TERMINATE_REASON(pub i32); pub const RTCTR_NORMAL: RTC_TERMINATE_REASON = RTC_TERMINATE_REASON(0i32); pub const RTCTR_DND: RTC_TERMINATE_REASON = RTC_TERMINATE_REASON(1i32); pub const RTCTR_BUSY: RTC_TERMINATE_REASON = RTC_TERMINATE_REASON(2i32); pub const RTCTR_REJECT: RTC_TERMINATE_REASON = RTC_TERMINATE_REASON(3i32); pub const RTCTR_TIMEOUT: RTC_TERMINATE_REASON = RTC_TERMINATE_REASON(4i32); pub const RTCTR_SHUTDOWN: RTC_TERMINATE_REASON = RTC_TERMINATE_REASON(5i32); pub const RTCTR_INSUFFICIENT_SECURITY_LEVEL: RTC_TERMINATE_REASON = RTC_TERMINATE_REASON(6i32); pub const RTCTR_NOT_SUPPORTED: RTC_TERMINATE_REASON = RTC_TERMINATE_REASON(7i32); impl ::core::convert::From<i32> for RTC_TERMINATE_REASON { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_TERMINATE_REASON { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_USER_SEARCH_COLUMN(pub i32); pub const RTCUSC_URI: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(0i32); pub const RTCUSC_DISPLAYNAME: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(1i32); pub const RTCUSC_TITLE: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(2i32); pub const RTCUSC_OFFICE: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(3i32); pub const RTCUSC_PHONE: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(4i32); pub const RTCUSC_COMPANY: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(5i32); pub const RTCUSC_CITY: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(6i32); pub const RTCUSC_STATE: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(7i32); pub const RTCUSC_COUNTRY: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(8i32); pub const RTCUSC_EMAIL: RTC_USER_SEARCH_COLUMN = RTC_USER_SEARCH_COLUMN(9i32); impl ::core::convert::From<i32> for RTC_USER_SEARCH_COLUMN { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_USER_SEARCH_COLUMN { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_USER_SEARCH_PREFERENCE(pub i32); pub const RTCUSP_MAX_MATCHES: RTC_USER_SEARCH_PREFERENCE = RTC_USER_SEARCH_PREFERENCE(0i32); pub const RTCUSP_TIME_LIMIT: RTC_USER_SEARCH_PREFERENCE = RTC_USER_SEARCH_PREFERENCE(1i32); impl ::core::convert::From<i32> for RTC_USER_SEARCH_PREFERENCE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_USER_SEARCH_PREFERENCE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_VIDEO_DEVICE(pub i32); pub const RTCVD_RECEIVE: RTC_VIDEO_DEVICE = RTC_VIDEO_DEVICE(0i32); pub const RTCVD_PREVIEW: RTC_VIDEO_DEVICE = RTC_VIDEO_DEVICE(1i32); impl ::core::convert::From<i32> for RTC_VIDEO_DEVICE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_VIDEO_DEVICE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_WATCHER_EVENT_TYPE(pub i32); pub const RTCWET_WATCHER_ADD: RTC_WATCHER_EVENT_TYPE = RTC_WATCHER_EVENT_TYPE(0i32); pub const RTCWET_WATCHER_REMOVE: RTC_WATCHER_EVENT_TYPE = RTC_WATCHER_EVENT_TYPE(1i32); pub const RTCWET_WATCHER_UPDATE: RTC_WATCHER_EVENT_TYPE = RTC_WATCHER_EVENT_TYPE(2i32); pub const RTCWET_WATCHER_OFFERING: RTC_WATCHER_EVENT_TYPE = RTC_WATCHER_EVENT_TYPE(3i32); pub const RTCWET_WATCHER_ROAMED: RTC_WATCHER_EVENT_TYPE = RTC_WATCHER_EVENT_TYPE(4i32); impl ::core::convert::From<i32> for RTC_WATCHER_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_WATCHER_EVENT_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_WATCHER_MATCH_MODE(pub i32); pub const RTCWMM_EXACT_MATCH: RTC_WATCHER_MATCH_MODE = RTC_WATCHER_MATCH_MODE(0i32); pub const RTCWMM_BEST_ACE_MATCH: RTC_WATCHER_MATCH_MODE = RTC_WATCHER_MATCH_MODE(1i32); impl ::core::convert::From<i32> for RTC_WATCHER_MATCH_MODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_WATCHER_MATCH_MODE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct RTC_WATCHER_STATE(pub i32); pub const RTCWS_UNKNOWN: RTC_WATCHER_STATE = RTC_WATCHER_STATE(0i32); pub const RTCWS_OFFERING: RTC_WATCHER_STATE = RTC_WATCHER_STATE(1i32); pub const RTCWS_ALLOWED: RTC_WATCHER_STATE = RTC_WATCHER_STATE(2i32); pub const RTCWS_BLOCKED: RTC_WATCHER_STATE = RTC_WATCHER_STATE(3i32); pub const RTCWS_DENIED: RTC_WATCHER_STATE = RTC_WATCHER_STATE(4i32); pub const RTCWS_PROMPT: RTC_WATCHER_STATE = RTC_WATCHER_STATE(5i32); impl ::core::convert::From<i32> for RTC_WATCHER_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for RTC_WATCHER_STATE { type Abi = Self; } pub const STATUS_SEVERITY_RTC_ERROR: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Networking_WinSock")] pub struct TRANSPORT_SETTING { pub SettingId: super::super::Networking::WinSock::TRANSPORT_SETTING_ID, pub Length: *mut u32, pub Value: *mut u8, } #[cfg(feature = "Win32_Networking_WinSock")] impl TRANSPORT_SETTING {} #[cfg(feature = "Win32_Networking_WinSock")] impl ::core::default::Default for TRANSPORT_SETTING { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Networking_WinSock")] impl ::core::fmt::Debug for TRANSPORT_SETTING { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TRANSPORT_SETTING").field("SettingId", &self.SettingId).field("Length", &self.Length).field("Value", &self.Value).finish() } } #[cfg(feature = "Win32_Networking_WinSock")] impl ::core::cmp::PartialEq for TRANSPORT_SETTING { fn eq(&self, other: &Self) -> bool { self.SettingId == other.SettingId && self.Length == other.Length && self.Value == other.Value } } #[cfg(feature = "Win32_Networking_WinSock")] impl ::core::cmp::Eq for TRANSPORT_SETTING {} #[cfg(feature = "Win32_Networking_WinSock")] unsafe impl ::windows::core::Abi for TRANSPORT_SETTING { type Abi = Self; }
//! CLI handling for object store config (via CLI arguments and environment variables). use futures::TryStreamExt; use object_store::memory::InMemory; use object_store::path::Path; use object_store::throttle::ThrottledStore; use object_store::{throttle::ThrottleConfig, DynObjectStore}; use observability_deps::tracing::{info, warn}; use snafu::{ResultExt, Snafu}; use std::sync::Arc; use std::{fs, num::NonZeroUsize, path::PathBuf, time::Duration}; use uuid::Uuid; #[derive(Debug, Snafu)] #[allow(missing_docs)] pub enum ParseError { #[snafu(display("Unable to create database directory {:?}: {}", path, source))] CreatingDatabaseDirectory { path: PathBuf, source: std::io::Error, }, #[snafu(display("Unable to create local store {:?}: {}", path, source))] CreateLocalFileSystem { path: PathBuf, source: object_store::Error, }, #[snafu(display( "Specified {:?} for the object store, required configuration missing for {}", object_store, missing ))] MissingObjectStoreConfig { object_store: ObjectStoreType, missing: String, }, // Creating a new S3 object store can fail if the region is *specified* but // not *parseable* as a rusoto `Region`. The other object store constructors // don't return `Result`. #[snafu(display("Error configuring Amazon S3: {}", source))] InvalidS3Config { source: object_store::Error }, #[snafu(display("Error configuring GCS: {}", source))] InvalidGCSConfig { source: object_store::Error }, #[snafu(display("Error configuring Microsoft Azure: {}", source))] InvalidAzureConfig { source: object_store::Error }, } /// The AWS region to use for Amazon S3 based object storage if none is /// specified. pub const FALLBACK_AWS_REGION: &str = "us-east-1"; /// CLI config for object stores. #[derive(Debug, Clone, clap::Parser)] pub struct ObjectStoreConfig { /// Which object storage to use. If not specified, defaults to memory. /// /// Possible values (case insensitive): /// /// * memory (default): Effectively no object persistence. /// * memorythrottled: Like `memory` but with latency and throughput that somewhat resamble a cloud /// object store. Useful for testing and benchmarking. /// * file: Stores objects in the local filesystem. Must also set `--data-dir`. /// * s3: Amazon S3. Must also set `--bucket`, `--aws-access-key-id`, `--aws-secret-access-key`, and /// possibly `--aws-default-region`. /// * google: Google Cloud Storage. Must also set `--bucket` and `--google-service-account`. /// * azure: Microsoft Azure blob storage. Must also set `--bucket`, `--azure-storage-account`, /// and `--azure-storage-access-key`. #[clap( value_enum, long = "object-store", env = "INFLUXDB_IOX_OBJECT_STORE", ignore_case = true, action )] pub object_store: Option<ObjectStoreType>, /// Name of the bucket to use for the object store. Must also set /// `--object-store` to a cloud object storage to have any effect. /// /// If using Google Cloud Storage for the object store, this item as well /// as `--google-service-account` must be set. /// /// If using S3 for the object store, must set this item as well /// as `--aws-access-key-id` and `--aws-secret-access-key`. Can also set /// `--aws-default-region` if not using the fallback region. /// /// If using Azure for the object store, set this item to the name of a /// container you've created in the associated storage account, under /// Blob Service > Containers. Must also set `--azure-storage-account` and /// `--azure-storage-access-key`. #[clap(long = "bucket", env = "INFLUXDB_IOX_BUCKET", action)] pub bucket: Option<String>, /// The location InfluxDB IOx will use to store files locally. #[clap(long = "data-dir", env = "INFLUXDB_IOX_DB_DIR", action)] pub database_directory: Option<PathBuf>, /// When using Amazon S3 as the object store, set this to an access key that /// has permission to read from and write to the specified S3 bucket. /// /// Must also set `--object-store=s3`, `--bucket`, and /// `--aws-secret-access-key`. Can also set `--aws-default-region` if not /// using the fallback region. /// /// Prefer the environment variable over the command line flag in shared /// environments. #[clap(long = "aws-access-key-id", env = "AWS_ACCESS_KEY_ID", action)] pub aws_access_key_id: Option<String>, /// When using Amazon S3 as the object store, set this to the secret access /// key that goes with the specified access key ID. /// /// Must also set `--object-store=s3`, `--bucket`, `--aws-access-key-id`. /// Can also set `--aws-default-region` if not using the fallback region. /// /// Prefer the environment variable over the command line flag in shared /// environments. #[clap(long = "aws-secret-access-key", env = "AWS_SECRET_ACCESS_KEY", action)] pub aws_secret_access_key: Option<String>, /// When using Amazon S3 as the object store, set this to the region /// that goes with the specified bucket if different from the fallback /// value. /// /// Must also set `--object-store=s3`, `--bucket`, `--aws-access-key-id`, /// and `--aws-secret-access-key`. #[clap( long = "aws-default-region", env = "AWS_DEFAULT_REGION", default_value = FALLBACK_AWS_REGION, action, )] pub aws_default_region: String, /// When using Amazon S3 compatibility storage service, set this to the /// endpoint. /// /// Must also set `--object-store=s3`, `--bucket`. Can also set `--aws-default-region` /// if not using the fallback region. /// /// Prefer the environment variable over the command line flag in shared /// environments. #[clap(long = "aws-endpoint", env = "AWS_ENDPOINT", action)] pub aws_endpoint: Option<String>, /// When using Amazon S3 as an object store, set this to the session token. This is handy when using a federated /// login / SSO and you fetch credentials via the UI. /// /// Is it assumed that the session is valid as long as the IOx server is running. /// /// Prefer the environment variable over the command line flag in shared /// environments. #[clap(long = "aws-session-token", env = "AWS_SESSION_TOKEN", action)] pub aws_session_token: Option<String>, /// Allow unencrypted HTTP connection to AWS. #[clap(long = "aws-allow-http", env = "AWS_ALLOW_HTTP", action)] pub aws_allow_http: bool, /// When using Google Cloud Storage as the object store, set this to the /// path to the JSON file that contains the Google credentials. /// /// Must also set `--object-store=google` and `--bucket`. #[clap( long = "google-service-account", env = "GOOGLE_SERVICE_ACCOUNT", action )] pub google_service_account: Option<String>, /// When using Microsoft Azure as the object store, set this to the /// name you see when going to All Services > Storage accounts > `[name]`. /// /// Must also set `--object-store=azure`, `--bucket`, and /// `--azure-storage-access-key`. #[clap(long = "azure-storage-account", env = "AZURE_STORAGE_ACCOUNT", action)] pub azure_storage_account: Option<String>, /// When using Microsoft Azure as the object store, set this to one of the /// Key values in the Storage account's Settings > Access keys. /// /// Must also set `--object-store=azure`, `--bucket`, and /// `--azure-storage-account`. /// /// Prefer the environment variable over the command line flag in shared /// environments. #[clap( long = "azure-storage-access-key", env = "AZURE_STORAGE_ACCESS_KEY", action )] pub azure_storage_access_key: Option<String>, /// When using a network-based object store, limit the number of connection to this value. #[clap( long = "object-store-connection-limit", env = "OBJECT_STORE_CONNECTION_LIMIT", default_value = "16", action )] pub object_store_connection_limit: NonZeroUsize, } impl ObjectStoreConfig { /// Create a new instance for all-in-one mode, only allowing some arguments. pub fn new(database_directory: Option<PathBuf>) -> Self { match &database_directory { Some(dir) => info!("Object store: File-based in `{}`", dir.display()), None => info!("Object store: In-memory"), } let object_store = database_directory.as_ref().map(|_| ObjectStoreType::File); Self { aws_access_key_id: Default::default(), aws_allow_http: Default::default(), aws_default_region: Default::default(), aws_endpoint: Default::default(), aws_secret_access_key: Default::default(), aws_session_token: Default::default(), azure_storage_access_key: Default::default(), azure_storage_account: Default::default(), bucket: Default::default(), database_directory, google_service_account: Default::default(), object_store, object_store_connection_limit: NonZeroUsize::new(16).unwrap(), } } } /// Object-store type. #[derive(Debug, Copy, Clone, PartialEq, Eq, clap::ValueEnum)] pub enum ObjectStoreType { /// In-memory. Memory, /// In-memory with additional throttling applied for testing MemoryThrottled, /// Filesystem. File, /// AWS S3. S3, /// GCS. Google, /// Azure object store. Azure, } #[cfg(feature = "gcp")] fn new_gcs(config: &ObjectStoreConfig) -> Result<Arc<DynObjectStore>, ParseError> { use object_store::gcp::GoogleCloudStorageBuilder; use object_store::limit::LimitStore; info!(bucket=?config.bucket, object_store_type="GCS", "Object Store"); let mut builder = GoogleCloudStorageBuilder::new(); if let Some(bucket) = &config.bucket { builder = builder.with_bucket_name(bucket); } if let Some(account) = &config.google_service_account { builder = builder.with_service_account_path(account); } Ok(Arc::new(LimitStore::new( builder.build().context(InvalidGCSConfigSnafu)?, config.object_store_connection_limit.get(), ))) } #[cfg(not(feature = "gcp"))] fn new_gcs(_: &ObjectStoreConfig) -> Result<Arc<DynObjectStore>, ParseError> { panic!("GCS support not enabled, recompile with the gcp feature enabled") } #[cfg(feature = "aws")] fn new_s3(config: &ObjectStoreConfig) -> Result<Arc<DynObjectStore>, ParseError> { use object_store::aws::AmazonS3Builder; use object_store::limit::LimitStore; info!(bucket=?config.bucket, endpoint=?config.aws_endpoint, object_store_type="S3", "Object Store"); let mut builder = AmazonS3Builder::new() .with_allow_http(config.aws_allow_http) .with_region(&config.aws_default_region) .with_imdsv1_fallback(); if let Some(bucket) = &config.bucket { builder = builder.with_bucket_name(bucket); } if let Some(key_id) = &config.aws_access_key_id { builder = builder.with_access_key_id(key_id); } if let Some(token) = &config.aws_session_token { builder = builder.with_token(token); } if let Some(secret) = &config.aws_secret_access_key { builder = builder.with_secret_access_key(secret); } if let Some(endpoint) = &config.aws_endpoint { builder = builder.with_endpoint(endpoint); } Ok(Arc::new(LimitStore::new( builder.build().context(InvalidS3ConfigSnafu)?, config.object_store_connection_limit.get(), ))) } #[cfg(not(feature = "aws"))] fn new_s3(_: &ObjectStoreConfig) -> Result<Arc<DynObjectStore>, ParseError> { panic!("S3 support not enabled, recompile with the aws feature enabled") } #[cfg(feature = "azure")] fn new_azure(config: &ObjectStoreConfig) -> Result<Arc<DynObjectStore>, ParseError> { use object_store::azure::MicrosoftAzureBuilder; use object_store::limit::LimitStore; info!(bucket=?config.bucket, account=?config.azure_storage_account, object_store_type="Azure", "Object Store"); let mut builder = MicrosoftAzureBuilder::new(); if let Some(bucket) = &config.bucket { builder = builder.with_container_name(bucket); } if let Some(account) = &config.azure_storage_account { builder = builder.with_account(account) } if let Some(key) = &config.azure_storage_access_key { builder = builder.with_access_key(key) } Ok(Arc::new(LimitStore::new( builder.build().context(InvalidAzureConfigSnafu)?, config.object_store_connection_limit.get(), ))) } #[cfg(not(feature = "azure"))] fn new_azure(_: &ObjectStoreConfig) -> Result<Arc<DynObjectStore>, ParseError> { panic!("Azure blob storage support not enabled, recompile with the azure feature enabled") } /// Create config-dependant object store. pub fn make_object_store(config: &ObjectStoreConfig) -> Result<Arc<DynObjectStore>, ParseError> { if let Some(data_dir) = &config.database_directory { if !matches!(&config.object_store, Some(ObjectStoreType::File)) { warn!(?data_dir, object_store_type=?config.object_store, "--data-dir / `INFLUXDB_IOX_DB_DIR` ignored. It only affects 'file' object stores"); } } match &config.object_store { Some(ObjectStoreType::Memory) | None => { info!(object_store_type = "Memory", "Object Store"); Ok(Arc::new(InMemory::new())) } Some(ObjectStoreType::MemoryThrottled) => { let config = ThrottleConfig { // for every call: assume a 100ms latency wait_delete_per_call: Duration::from_millis(100), wait_get_per_call: Duration::from_millis(100), wait_list_per_call: Duration::from_millis(100), wait_list_with_delimiter_per_call: Duration::from_millis(100), wait_put_per_call: Duration::from_millis(100), // for list operations: assume we need 1 call per 1k entries at 100ms wait_list_per_entry: Duration::from_millis(100) / 1_000, wait_list_with_delimiter_per_entry: Duration::from_millis(100) / 1_000, // for upload/download: assume 1GByte/s wait_get_per_byte: Duration::from_secs(1) / 1_000_000_000, }; info!(?config, object_store_type = "Memory", "Object Store"); Ok(Arc::new(ThrottledStore::new(InMemory::new(), config))) } Some(ObjectStoreType::Google) => new_gcs(config), Some(ObjectStoreType::S3) => new_s3(config), Some(ObjectStoreType::Azure) => new_azure(config), Some(ObjectStoreType::File) => match config.database_directory.as_ref() { Some(db_dir) => { info!(?db_dir, object_store_type = "Directory", "Object Store"); fs::create_dir_all(db_dir) .context(CreatingDatabaseDirectorySnafu { path: db_dir })?; let store = object_store::local::LocalFileSystem::new_with_prefix(db_dir) .context(CreateLocalFileSystemSnafu { path: db_dir })?; Ok(Arc::new(store)) } None => MissingObjectStoreConfigSnafu { object_store: ObjectStoreType::File, missing: "data-dir", } .fail(), }, } } #[derive(Debug, Snafu)] #[allow(missing_docs)] pub enum CheckError { #[snafu(display("Cannot read from object store: {}", source))] CannotReadObjectStore { source: object_store::Error }, } /// Check if object store is properly configured and accepts writes and reads. /// /// Note: This does NOT test if the object store is writable! pub async fn check_object_store(object_store: &DynObjectStore) -> Result<(), CheckError> { // Use some prefix that will very likely end in an empty result, so we don't pull too much actual data here. let uuid = Uuid::new_v4().to_string(); let prefix = Path::from_iter([uuid]); // create stream (this might fail if the store is not readable) let mut stream = object_store .list(Some(&prefix)) .await .context(CannotReadObjectStoreSnafu)?; // ... but sometimes it fails only if we use the resulting stream, so try that once stream .try_next() .await .context(CannotReadObjectStoreSnafu)?; // store seems to be readable Ok(()) } #[cfg(test)] mod tests { use super::*; use clap::Parser; use std::env; use tempfile::TempDir; #[test] fn default_object_store_is_memory() { let config = ObjectStoreConfig::try_parse_from(["server"]).unwrap(); let object_store = make_object_store(&config).unwrap(); assert_eq!(&object_store.to_string(), "InMemory") } #[test] fn explicitly_set_object_store_to_memory() { let config = ObjectStoreConfig::try_parse_from(["server", "--object-store", "memory"]).unwrap(); let object_store = make_object_store(&config).unwrap(); assert_eq!(&object_store.to_string(), "InMemory") } #[test] #[cfg(feature = "aws")] fn valid_s3_config() { let config = ObjectStoreConfig::try_parse_from([ "server", "--object-store", "s3", "--bucket", "mybucket", "--aws-access-key-id", "NotARealAWSAccessKey", "--aws-secret-access-key", "NotARealAWSSecretAccessKey", ]) .unwrap(); let object_store = make_object_store(&config).unwrap(); assert_eq!(&object_store.to_string(), "AmazonS3(mybucket)") } #[test] #[cfg(feature = "aws")] fn s3_config_missing_params() { let mut config = ObjectStoreConfig::try_parse_from(["server", "--object-store", "s3"]).unwrap(); // clean out eventual leaks via env variables config.bucket = None; let err = make_object_store(&config).unwrap_err().to_string(); assert_eq!( err, "Specified S3 for the object store, required configuration missing for bucket" ); } #[test] #[cfg(feature = "gcp")] fn valid_google_config() { let config = ObjectStoreConfig::try_parse_from([ "server", "--object-store", "google", "--bucket", "mybucket", "--google-service-account", "~/Not/A/Real/path.json", ]) .unwrap(); let object_store = make_object_store(&config).unwrap(); assert_eq!(&object_store.to_string(), "GoogleCloudStorage(mybucket)") } #[test] #[cfg(feature = "gcp")] fn google_config_missing_params() { let mut config = ObjectStoreConfig::try_parse_from(["server", "--object-store", "google"]).unwrap(); // clean out eventual leaks via env variables config.bucket = None; let err = make_object_store(&config).unwrap_err().to_string(); assert_eq!( err, "Specified Google for the object store, required configuration missing for \ bucket, google-service-account" ); } #[test] #[cfg(feature = "azure")] fn valid_azure_config() { let config = ObjectStoreConfig::try_parse_from([ "server", "--object-store", "azure", "--bucket", "mybucket", "--azure-storage-account", "NotARealStorageAccount", "--azure-storage-access-key", "NotARealKey", ]) .unwrap(); let object_store = make_object_store(&config).unwrap(); assert_eq!(&object_store.to_string(), "MicrosoftAzure(mybucket)") } #[test] #[cfg(feature = "azure")] fn azure_config_missing_params() { let mut config = ObjectStoreConfig::try_parse_from(["server", "--object-store", "azure"]).unwrap(); // clean out eventual leaks via env variables config.bucket = None; let err = make_object_store(&config).unwrap_err().to_string(); assert_eq!( err, "Specified Azure for the object store, required configuration missing for \ bucket, azure-storage-account, azure-storage-access-key" ); } #[test] fn valid_file_config() { let root = TempDir::new().unwrap(); let root_path = root.path().to_str().unwrap(); let config = ObjectStoreConfig::try_parse_from([ "server", "--object-store", "file", "--data-dir", root_path, ]) .unwrap(); let object_store = make_object_store(&config).unwrap().to_string(); assert!( object_store.starts_with("LocalFileSystem"), "{}", object_store ) } #[test] fn file_config_missing_params() { // this test tests for failure to configure the object store because of data-dir configuration missing // if the INFLUXDB_IOX_DB_DIR env variable is set, the test fails because the configuration is // actually present. env::remove_var("INFLUXDB_IOX_DB_DIR"); let config = ObjectStoreConfig::try_parse_from(["server", "--object-store", "file"]).unwrap(); let err = make_object_store(&config).unwrap_err().to_string(); assert_eq!( err, "Specified File for the object store, required configuration missing for \ data-dir" ); } }
use aoc2018::*; #[derive(Clone, Copy, Debug)] enum Area { Track, Inter, Slash, BackSlash, } #[derive(Clone, Copy, Debug)] enum Dir { Right, Left, Up, Down, } impl Dir { fn apply(&mut self, g: Area, turn: &mut Turn) { *self = match (*self, g) { (_, Area::Track) => return, (dir, Area::Inter) => turn.apply(dir), (Dir::Left, Area::Slash) => Dir::Down, (Dir::Left, Area::BackSlash) => Dir::Up, (Dir::Right, Area::Slash) => Dir::Up, (Dir::Right, Area::BackSlash) => Dir::Down, (Dir::Up, Area::Slash) => Dir::Right, (Dir::Up, Area::BackSlash) => Dir::Left, (Dir::Down, Area::Slash) => Dir::Left, (Dir::Down, Area::BackSlash) => Dir::Right, }; } } #[derive(Clone, Copy, Debug)] enum Turn { Left, Straight, Right, } type Cart = ((i64, i64), Turn, Dir); impl Turn { fn apply(&mut self, cart: Dir) -> Dir { let out = match (*self, cart) { (Turn::Left, Dir::Up) => Dir::Left, (Turn::Left, Dir::Left) => Dir::Down, (Turn::Left, Dir::Down) => Dir::Right, (Turn::Left, Dir::Right) => Dir::Up, (Turn::Straight, cart) => cart, (Turn::Right, Dir::Up) => Dir::Right, (Turn::Right, Dir::Right) => Dir::Down, (Turn::Right, Dir::Down) => Dir::Left, (Turn::Right, Dir::Left) => Dir::Up, }; *self = match *self { Turn::Left => Turn::Straight, Turn::Straight => Turn::Right, Turn::Right => Turn::Left, }; out } } fn solve(first: bool, grid: &HashMap<(i64, i64), Area>, mut carts: Vec<Cart>) -> (i64, i64) { loop { if carts.len() == 1 { return carts.into_iter().next().unwrap().0; } let mut positions = HashSet::new(); let mut remove = HashSet::new(); carts.sort_by(|a, b| { let (x0, y0) = a.0; let (x1, y1) = b.0; (y0, x0).cmp(&(y1, x1)) }); for (pos, _, _) in &mut carts { if !positions.insert(pos.clone()) { if first { return *pos; } remove.insert(*pos); } } // no crashes, run simulation. for (_, (ref mut pos, ref mut turn, ref mut dir)) in carts.iter_mut().enumerate() { if remove.contains(pos) { continue; } positions.remove(pos); match *dir { Dir::Left => pos.0 -= 1, Dir::Right => pos.0 += 1, Dir::Up => pos.1 -= 1, Dir::Down => pos.1 += 1, } if !positions.insert(*pos) { if first { return *pos; } remove.insert(*pos); continue; } let g = match grid.get(pos).cloned() { Some(g) => g, None => panic!("nothing on grid: {:?}", pos), }; dir.apply(g, turn); } if !remove.is_empty() { carts = carts .into_iter() .filter(|c| !remove.contains(&c.0)) .collect(); } } } fn main() -> Result<(), Error> { //let lines = lines!(input!("day13.txt"), u32).collect::<Result<Vec<_>, _>>()?; //let columns = columns!(input!("day13.txt"), char::is_whitespace, u32); let lines = input_str!("day13.txt").lines().collect::<Vec<_>>(); let mut carts = Vec::new(); let mut grid = HashMap::new(); for (y, line) in lines.into_iter().enumerate() { for (x, c) in line.chars().enumerate() { let (x, y) = (x as i64, y as i64); match c { '+' => { grid.insert((x, y), Area::Inter); } '/' => { grid.insert((x, y), Area::Slash); } '\\' => { grid.insert((x, y), Area::BackSlash); } '-' | '|' => { grid.insert((x, y), Area::Track); } '>' => { carts.push(((x, y), Turn::Left, Dir::Right)); grid.insert((x, y), Area::Track); } '^' => { carts.push(((x, y), Turn::Left, Dir::Up)); grid.insert((x, y), Area::Track); } '<' => { carts.push(((x, y), Turn::Left, Dir::Left)); grid.insert((x, y), Area::Track); } 'v' => { carts.push(((x, y), Turn::Left, Dir::Down)); grid.insert((x, y), Area::Track); } ' ' => {} o => { panic!("unsupported: {}", o); } } } } assert_eq!(solve(true, &grid, carts.clone()), (83, 49)); assert_eq!(solve(false, &grid, carts.clone()), (73, 36)); Ok(()) }
use std::collections::VecDeque; use std::sync::{Arc, Condvar, Mutex}; // Decision Decisions (as per this commit): // - Sends contented with one another i.e senders are also synced btw themselves. // - We don't have a bounded variant of sender, which can allow some sort of sync // by using a fixed size buffer. There is no back-pressure in our implementation. // Flavours: // - Syncrhonous channels: Channel where send() can bloc, and has limited capacity. // : Mutex + CondVar: VecDeque with Bounded // : (Cross beam) Atomic VecDeque + thread::park + thread::Thread::notify (for the notification system btw senders and recievers) // - Asynchronous channels: Channel where send() cannot bloc, unbounded. // : Mutex + Condvar + VecDeque (Our approach) // : Atomic Linked List or Atomic Queue // : Atomic block Linkerd List, linked list of atomic VecDequeue<T> used in cross beam // : Mutex + Condvar + LinkedList (so that we can mitigate the resizing problem) // - Rendezvous channels: Synchronous Channel with capacity = 0, Used for thread synchronization // : Condvar + Mutex // - Oneshot channels: Any capacity, In practice, only one call to send() // async/await // Hard to write a channel implemention to write a channel that works for both // If you do a send and the channel is full, in async world you want to yield to the executor, // and at some point you will be woken up to send. // Similar with Condvar but not the same as async functions have to return. // Inner is Arc, because sneder and receiver need to share the same instance of Inner // Sender should be clonable as its mspc, but if it is done using derive proc macro // then it expects T to be also clonable, thus restricting our channel to only clonable // T's. In our case, T is wrapped around in Arc, which is clonable (obvv, thats what it is for) // So, Let's implement clone ourselves manually pub struct Sender<T> { shared: Arc<Shared<T>>, } impl<T> Clone for Sender<T> { fn clone(&self) -> Self { // udate senders after cloning let mut inner = self.shared.inner.lock().unwrap(); inner.senders += 1; drop(inner); Sender { // this is technically legal, but not the right way // imagine if self.innner also implemented clone, rust won't // know whether this call is for Arc or inside of Arc // as Arc derefs into the inner type // So, use Arc::clone() to specifically call the clone of the arc but not inside shared: Arc::clone(&self.shared), } } } impl<T> Drop for Sender<T> { fn drop(&mut self) { let mut inner = self.shared.inner.lock().unwrap(); inner.senders -= 1; let was_last = inner.senders == 0; drop(inner); // check and notify if last // we can wakeup everytime but unnecessary perf if was_last { self.shared.available.notify_one(); } } } impl<T> Sender<T> { // In the current design, there are no waiting senders as when a lock is acquired // the sending will work pub fn send(&mut self, t: T) { let mut inner = self.shared.inner.lock().unwrap(); inner.queue.push_back(t); // drop the lock, so that the reciever can wake up and acquere drop(inner); // notify reciever after send happens // notify_one notifies one of the thread waiting for available condvar self.shared.available.notify_one(); } } pub struct Receiver<T> { shared: Arc<Shared<T>>, // As we know there is only one reciever, so why take a lock everytime? // why not just pop all the elements into this buffer when you acquire a lock // so that we can directly reply from this bufffer until its empty. Cool Right? buffer: VecDeque<T>, } impl<T> Receiver<T> { // receive should be blocking, as when there is no element // the receive function should make the thread wait pub fn receive(&mut self) -> Option<T> { // When there are elements in the buffer directly reply if let Some(t) = self.buffer.pop_front() { return Some(t); } // loop because when ever we are woken up by wait i.e when a new element is added // we want to pop the value. // loop also helps because there are no guarantees from OS that this will be woken // up only when there is a element, so having loop helps us wait again if there is // no element added let mut inner = self.shared.inner.lock().unwrap(); loop { match inner.queue.pop_front() { Some(t) => { // Just take all the elements into the buffer // so that we don't block for the next n recieve requests. if !inner.queue.is_empty() { // swap the empty self.buffer with the inner queue // self.buffer is emtpy as it this code-path is reached std::mem::swap(&mut self.buffer, &mut inner.queue); } return Some(t); } None if inner.senders == 0 => return None, None => { // wait takes a mutex, because the assumption is // we can't wait while still holding the mutex, // because otherwise whover woke you up can't get the mutex // wait gives up the lock before waiting and it also gives // back the handle acquiring it so that we don't have to inner = self.shared.available.wait(inner).unwrap(); } } } } } // queue is Mutex, because it has to mutually be accessed by both sender and reciever without racing struct Shared<T> { inner: Mutex<Inner<T>>, // Condvar uses OS based condvar internally // this condvar should be outside the mutex, so that when we notify using condvar the other side // should be able to acqure the mutex, and they can't do that if condvar is part of the mutex. available: Condvar, } struct Inner<T> { queue: VecDeque<T>, senders: i32, } pub fn channel<T>() -> (Sender<T>, Receiver<T>) { let inner = Inner { queue: VecDeque::default(), senders: 1, }; let shared = Shared { inner: Mutex::new(inner), available: Condvar::new(), }; let shared = Arc::new(shared); ( Sender { shared: shared.clone(), }, Receiver { shared: shared.clone(), buffer: VecDeque::new(), }, ) } #[cfg(test)] mod tests { use super::*; #[test] fn ping_pong() { let (mut tx, mut rx) = channel(); tx.send(42); assert_eq!(rx.receive(), Some(42)); } #[test] fn closed_tx() { let (tx, mut rx) = channel::<i32>(); drop(tx); assert_eq!(rx.receive(), None) } #[test] fn closed_rx() { let (mut tx, rx) = channel::<i32>(); drop(rx); tx.send(42); } #[test] fn threaded_ping_pong() {} }
#[doc = "Reader of register RIS"] pub type R = crate::R<u32, super::RIS>; #[doc = "Reader of field `FPIDCRIS`"] pub type FPIDCRIS_R = crate::R<bool, bool>; #[doc = "Reader of field `FPDZCRIS`"] pub type FPDZCRIS_R = crate::R<bool, bool>; #[doc = "Reader of field `FPIOCRIS`"] pub type FPIOCRIS_R = crate::R<bool, bool>; #[doc = "Reader of field `FPUFCRIS`"] pub type FPUFCRIS_R = crate::R<bool, bool>; #[doc = "Reader of field `FPOFCRIS`"] pub type FPOFCRIS_R = crate::R<bool, bool>; #[doc = "Reader of field `FPIXCRIS`"] pub type FPIXCRIS_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - Floating-Point Input Denormal Exception Raw Interrupt Status"] #[inline(always)] pub fn fpidcris(&self) -> FPIDCRIS_R { FPIDCRIS_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Floating-Point Divide By 0 Exception Raw Interrupt Status"] #[inline(always)] pub fn fpdzcris(&self) -> FPDZCRIS_R { FPDZCRIS_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - Floating-Point Invalid Operation Raw Interrupt Status"] #[inline(always)] pub fn fpiocris(&self) -> FPIOCRIS_R { FPIOCRIS_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - Floating-Point Underflow Exception Raw Interrupt Status"] #[inline(always)] pub fn fpufcris(&self) -> FPUFCRIS_R { FPUFCRIS_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - Floating-Point Overflow Exception Raw Interrupt Status"] #[inline(always)] pub fn fpofcris(&self) -> FPOFCRIS_R { FPOFCRIS_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - Floating-Point Inexact Exception Raw Interrupt Status"] #[inline(always)] pub fn fpixcris(&self) -> FPIXCRIS_R { FPIXCRIS_R::new(((self.bits >> 5) & 0x01) != 0) } }
use std::iter::IntoIterator; use std::iter::Iterator; // Unlike src1.rs, this base structure is generic over any type T, where T is a Copy type. // This constrains NewStruct objects to containing values that are primitive types like char, bool, i8, u8, etc. #[derive(Copy,Clone)] pub struct NewStruct<T> where T: Copy { field1: T, field2: T, field3: T, field4: T, field5: T, } // The clause where: T Copy means that NewStructIntoIter only accepts NewStruct objects whose fields implement the Copy trait. pub struct NewStructIntoIter<T> where T: Copy { count: usize, new_struct: NewStruct<T>, } /* * The IntoIterator trait declaration for your reference. * pub trait IntoIterator * where Self::IntoIter::Item == Self::Item { * * type Item; * type IntoIter: Iterator; * * fn into_iter( self ) -> Self::IntoIter; * } */ // Now our trait implementation requires impl<T> to introduce the generic type parameter T into scope impl<T> IntoIterator for NewStruct<T> where T: Copy { type Item = T; type IntoIter = NewStructIntoIter<T>; // for this implementation to be valid, NewStructIntoIter needs to implement Iterator // trait. This is precisely what IntoIter: Iterator means in the trait definition above. fn into_iter( self: Self ) -> NewStructIntoIter<T> { NewStructIntoIter { count: 0 as usize, new_struct: self, // This is a bitwise copy of self since we are using Copy types, no move occurs here } } }
/* * Copyright © 2019 Peter M. Stahl pemistahl@gmail.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. * See the License for the specific language governing permissions and * limitations under the License. */ use std::io::Write; use std::process::Command; use assert_cmd::prelude::*; use predicates::prelude::*; use tempfile::NamedTempFile; #[test] fn assert_that_grex_succeeds_with_direct_input() { let mut grex = call_grex(); grex.args(&["a", "b", "c"]); grex.assert().success().stdout(predicate::eq("^[a-c]$\n")); } #[test] #[allow(unused_must_use)] fn assert_that_grex_suceeds_with_file_input() { let mut file = NamedTempFile::new().unwrap(); writeln!(file, "a\nb\\n\nc\näöü\n♥"); let mut grex = call_grex(); grex.args(&["-f", file.path().to_str().unwrap()]); grex.assert() .success() .stdout(predicate::eq("^b\\\\n|äöü|[ac♥]$\n")); } #[test] fn assert_that_grex_fails_without_arguments() { let mut grex = call_grex(); grex.assert().failure().stderr(predicate::str::contains( "required arguments were not provided", )); } #[test] fn assert_that_grex_fails_when_file_name_is_not_provided() { let mut grex = call_grex(); grex.arg("-f"); grex.assert().failure().stderr(predicate::str::contains( "argument '--file <FILE>' requires a value but none was supplied", )); } #[test] fn assert_that_grex_fails_when_file_does_not_exist() { let mut grex = call_grex(); grex.args(&["-f", "/path/to/non-existing/file"]); grex.assert() .success() .stdout(predicate::str::is_empty()) .stderr(predicate::eq( "error: The file \"/path/to/non-existing/file\" could not be found\n", )); } #[test] fn assert_that_grex_fails_with_both_direct_and_file_input() { let mut grex = call_grex(); grex.args(&["a", "b", "c"]); grex.args(&["-f", "/path/to/some/file"]); grex.assert().failure().stderr(predicate::str::contains( "argument '--file <FILE>' cannot be used with 'input'", )); } fn call_grex() -> Command { Command::cargo_bin("grex").unwrap() }
use crate::smb2::responses; /// Decodes the little endian encoded session setup response from the server. /// /// Note: The security buffer is decoded separately. pub fn decode_session_setup_response_body( encoded_body: Vec<u8>, ) -> responses::session_setup::SessionSetup { let mut session_setup_response = responses::session_setup::SessionSetup::default(); session_setup_response.structure_size = encoded_body[..2].to_vec(); session_setup_response.session_flags = Some( responses::session_setup::SessionFlags::map_byte_code_to_session_flags( encoded_body[2..4].to_vec(), ), ); session_setup_response.security_buffer_offset = encoded_body[4..6].to_vec(); session_setup_response.security_buffer_length = encoded_body[6..8].to_vec(); session_setup_response.buffer = encoded_body[8..].to_vec(); session_setup_response } #[cfg(test)] mod tests { use super::*; #[test] fn test_decode_session_setup_response_body() { let mut encoded_session_response_body: Vec<u8> = b"\x09\x00\x00\x00\x48\x00\xd1\x00".to_vec(); let security_blob: Vec<u8> = b"\xa1\x81\ \xce\x30\x81\xcb\xa0\x03\x0a\x01\x01\xa1\x0c\x06\x0a\x2b\x06\x01\ \x04\x01\x82\x37\x02\x02\x0a\xa2\x81\xb5\x04\x81\xb2\x4e\x54\x4c\ \x4d\x53\x53\x50\x00\x02\x00\x00\x00\x16\x00\x16\x00\x38\x00\x00\ \x00\x15\x82\x8a\x62\x8d\x51\x0b\x30\x2d\x45\x71\xe0\x00\x00\x00\ \x00\x00\x00\x00\x00\x64\x00\x64\x00\x4e\x00\x00\x00\x06\x01\x00\ \x00\x00\x00\x00\x0f\x52\x00\x41\x00\x53\x00\x50\x00\x42\x00\x45\ \x00\x52\x00\x52\x00\x59\x00\x50\x00\x49\x00\x02\x00\x16\x00\x52\ \x00\x41\x00\x53\x00\x50\x00\x42\x00\x45\x00\x52\x00\x52\x00\x59\ \x00\x50\x00\x49\x00\x01\x00\x16\x00\x52\x00\x41\x00\x53\x00\x50\ \x00\x42\x00\x45\x00\x52\x00\x52\x00\x59\x00\x50\x00\x49\x00\x04\ \x00\x02\x00\x00\x00\x03\x00\x16\x00\x72\x00\x61\x00\x73\x00\x70\ \x00\x62\x00\x65\x00\x72\x00\x72\x00\x79\x00\x70\x00\x69\x00\x07\ \x00\x08\x00\x60\x16\xad\x6d\x47\x21\xd7\x01\x00\x00\x00\x00" .to_vec(); encoded_session_response_body.append(&mut security_blob.clone()); let mut expected_response = responses::session_setup::SessionSetup::default(); expected_response.session_flags = Some(responses::session_setup::SessionFlags::Zero); expected_response.security_buffer_offset = b"\x48\x00".to_vec(); expected_response.security_buffer_length = b"\xd1\x00".to_vec(); expected_response.buffer = security_blob; assert_eq!( expected_response, decode_session_setup_response_body(encoded_session_response_body) ); } }
trait Operation { fn touch(&mut self) -> (); } #[derive(Debug)] struct BigBlob { payload: String, } impl BigBlob { fn new() -> Self { println!("BigBlob created"); BigBlob { payload: "Me be the BigBlob!".to_string() } } } impl Operation for BigBlob { fn touch(&mut self) -> () { println!("BigBlob {:?} touched", self); } } struct BigBlobProxy { target: Option<Box<Operation>>, } impl BigBlobProxy { fn new() -> Self { println!("BigBlobProxy created"); BigBlobProxy { target: None } } } impl Operation for BigBlobProxy { fn touch(&mut self) -> () { match self.target { Some(ref mut t) => { println!("Performing proxied touch"); t.touch(); } None => { let mut bb = BigBlob::new(); bb.touch(); self.target = Some(Box::new(bb)); } } } } //* http://pl.wikipedia.org/wiki/Pe%C5%82nomocnik_%28wzorzec_projektowy%29 //* Rodzaje i zastosowanie //* //* Istnieją cztery rodzaje tego wzorca, które jednocześnie definiują sytuacje, w //* których może zostać użyty //* //* wirtualny – przechowuje obiekty, których utworzenie jest kosztowne; tworzy je //* na żądanie //* //* ochraniający – kontroluje dostęp do obiektu sprawdzając, czy obiekt //* wywołujący ma odpowiednie prawa do obiektu wywoływanego //* //* zdalny – czasami nazywany ambasadorem; reprezentuje obiekty znajdujące się w //* innej przestrzeni adresowej //* //* sprytne odwołanie – czasami nazywany sprytnym wskaźnikiem; pozwala na //* wykonanie dodatkowych akcji podczas dostępu do obiektu, takich jak: zliczanie //* referencji do obiektu czy ładowanie obiektu do pamięci pub fn run() { println!("-------------------- {} --------------------", file!()); //virtual proxy let mut r = BigBlobProxy::new(); r.touch(); r.touch(); r.touch(); }
#[allow(unused_imports)] use proconio::{ input, fastout, }; fn solve(n: usize) -> usize { let ans: usize; if n % 1000 == 0 { ans = 0; } else { ans = 1000 - (n % 1000); } ans } fn run() -> Result<(), Box<dyn std::error::Error>> { input! { n: usize, } println!("{}", solve(n)); Ok(()) } fn main() { match run() { Err(err) => panic!("{}", err), _ => (), }; }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" { pub fn WMCreateBackupRestorer(pcallback: ::windows_sys::core::IUnknown, ppbackup: *mut IWMLicenseBackup) -> ::windows_sys::core::HRESULT; pub fn WMCreateEditor(ppeditor: *mut IWMMetadataEditor) -> ::windows_sys::core::HRESULT; pub fn WMCreateIndexer(ppindexer: *mut IWMIndexer) -> ::windows_sys::core::HRESULT; pub fn WMCreateProfileManager(ppprofilemanager: *mut IWMProfileManager) -> ::windows_sys::core::HRESULT; pub fn WMCreateReader(punkcert: ::windows_sys::core::IUnknown, dwrights: u32, ppreader: *mut IWMReader) -> ::windows_sys::core::HRESULT; pub fn WMCreateSyncReader(punkcert: ::windows_sys::core::IUnknown, dwrights: u32, ppsyncreader: *mut IWMSyncReader) -> ::windows_sys::core::HRESULT; pub fn WMCreateWriter(punkcert: ::windows_sys::core::IUnknown, ppwriter: *mut IWMWriter) -> ::windows_sys::core::HRESULT; pub fn WMCreateWriterFileSink(ppsink: *mut IWMWriterFileSink) -> ::windows_sys::core::HRESULT; pub fn WMCreateWriterNetworkSink(ppsink: *mut IWMWriterNetworkSink) -> ::windows_sys::core::HRESULT; pub fn WMCreateWriterPushSink(ppsink: *mut IWMWriterPushSink) -> ::windows_sys::core::HRESULT; #[cfg(feature = "Win32_Foundation")] pub fn WMIsContentProtected(pwszfilename: super::super::Foundation::PWSTR, pfisprotected: *mut super::super::Foundation::BOOL) -> ::windows_sys::core::HRESULT; } #[repr(C)] pub struct AM_WMT_EVENT_DATA { pub hrStatus: ::windows_sys::core::HRESULT, pub pData: *mut ::core::ffi::c_void, } impl ::core::marker::Copy for AM_WMT_EVENT_DATA {} impl ::core::clone::Clone for AM_WMT_EVENT_DATA { fn clone(&self) -> Self { *self } } pub const CLSID_ClientNetManager: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3440550862, data2: 40002, data3: 4562, data4: [190, 237, 0, 96, 8, 47, 32, 84] }; pub const CLSID_WMBandwidthSharing_Exclusive: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 2942329002, data2: 20887, data3: 4562, data4: [182, 175, 0, 192, 79, 217, 8, 233] }; pub const CLSID_WMBandwidthSharing_Partial: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 2942329003, data2: 20887, data3: 4562, data4: [182, 175, 0, 192, 79, 217, 8, 233] }; pub const CLSID_WMMUTEX_Bitrate: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3605146113, data2: 13786, data3: 4561, data4: [144, 52, 0, 160, 201, 3, 73, 190] }; pub const CLSID_WMMUTEX_Language: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3605146112, data2: 13786, data3: 4561, data4: [144, 52, 0, 160, 201, 3, 73, 190] }; pub const CLSID_WMMUTEX_Presentation: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3605146114, data2: 13786, data3: 4561, data4: [144, 52, 0, 160, 201, 3, 73, 190] }; pub const CLSID_WMMUTEX_Unknown: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3605146115, data2: 13786, data3: 4561, data4: [144, 52, 0, 160, 201, 3, 73, 190] }; #[repr(C)] pub struct DRM_COPY_OPL { pub wMinimumCopyLevel: u16, pub oplIdIncludes: DRM_OPL_OUTPUT_IDS, pub oplIdExcludes: DRM_OPL_OUTPUT_IDS, } impl ::core::marker::Copy for DRM_COPY_OPL {} impl ::core::clone::Clone for DRM_COPY_OPL { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DRM_MINIMUM_OUTPUT_PROTECTION_LEVELS { pub wCompressedDigitalVideo: u16, pub wUncompressedDigitalVideo: u16, pub wAnalogVideo: u16, pub wCompressedDigitalAudio: u16, pub wUncompressedDigitalAudio: u16, } impl ::core::marker::Copy for DRM_MINIMUM_OUTPUT_PROTECTION_LEVELS {} impl ::core::clone::Clone for DRM_MINIMUM_OUTPUT_PROTECTION_LEVELS { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DRM_OPL_OUTPUT_IDS { pub cIds: u16, pub rgIds: *mut ::windows_sys::core::GUID, } impl ::core::marker::Copy for DRM_OPL_OUTPUT_IDS {} impl ::core::clone::Clone for DRM_OPL_OUTPUT_IDS { fn clone(&self) -> Self { *self } } pub const DRM_OPL_TYPES: u32 = 1u32; #[repr(C)] pub struct DRM_OUTPUT_PROTECTION { pub guidId: ::windows_sys::core::GUID, pub bConfigData: u8, } impl ::core::marker::Copy for DRM_OUTPUT_PROTECTION {} impl ::core::clone::Clone for DRM_OUTPUT_PROTECTION { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DRM_PLAY_OPL { pub minOPL: DRM_MINIMUM_OUTPUT_PROTECTION_LEVELS, pub oplIdReserved: DRM_OPL_OUTPUT_IDS, pub vopi: DRM_VIDEO_OUTPUT_PROTECTION_IDS, } impl ::core::marker::Copy for DRM_PLAY_OPL {} impl ::core::clone::Clone for DRM_PLAY_OPL { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DRM_VAL16 { pub val: [u8; 16], } impl ::core::marker::Copy for DRM_VAL16 {} impl ::core::clone::Clone for DRM_VAL16 { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DRM_VIDEO_OUTPUT_PROTECTION_IDS { pub cEntries: u16, pub rgVop: *mut DRM_OUTPUT_PROTECTION, } impl ::core::marker::Copy for DRM_VIDEO_OUTPUT_PROTECTION_IDS {} impl ::core::clone::Clone for DRM_VIDEO_OUTPUT_PROTECTION_IDS { fn clone(&self) -> Self { *self } } pub type IAMWMBufferPass = *mut ::core::ffi::c_void; pub type IAMWMBufferPassCallback = *mut ::core::ffi::c_void; pub type INSNetSourceCreator = *mut ::core::ffi::c_void; pub type INSSBuffer = *mut ::core::ffi::c_void; pub type INSSBuffer2 = *mut ::core::ffi::c_void; pub type INSSBuffer3 = *mut ::core::ffi::c_void; pub type INSSBuffer4 = *mut ::core::ffi::c_void; pub type IWMAddressAccess = *mut ::core::ffi::c_void; pub type IWMAddressAccess2 = *mut ::core::ffi::c_void; pub type IWMAuthorizer = *mut ::core::ffi::c_void; pub type IWMBackupRestoreProps = *mut ::core::ffi::c_void; pub type IWMBandwidthSharing = *mut ::core::ffi::c_void; pub type IWMClientConnections = *mut ::core::ffi::c_void; pub type IWMClientConnections2 = *mut ::core::ffi::c_void; pub type IWMCodecAMVideoAccelerator = *mut ::core::ffi::c_void; pub type IWMCodecInfo = *mut ::core::ffi::c_void; pub type IWMCodecInfo2 = *mut ::core::ffi::c_void; pub type IWMCodecInfo3 = *mut ::core::ffi::c_void; pub type IWMCodecVideoAccelerator = *mut ::core::ffi::c_void; pub type IWMCredentialCallback = *mut ::core::ffi::c_void; pub type IWMDRMEditor = *mut ::core::ffi::c_void; pub type IWMDRMMessageParser = *mut ::core::ffi::c_void; pub type IWMDRMReader = *mut ::core::ffi::c_void; pub type IWMDRMReader2 = *mut ::core::ffi::c_void; pub type IWMDRMReader3 = *mut ::core::ffi::c_void; pub type IWMDRMTranscryptionManager = *mut ::core::ffi::c_void; pub type IWMDRMTranscryptor = *mut ::core::ffi::c_void; pub type IWMDRMTranscryptor2 = *mut ::core::ffi::c_void; pub type IWMDRMWriter = *mut ::core::ffi::c_void; pub type IWMDRMWriter2 = *mut ::core::ffi::c_void; pub type IWMDRMWriter3 = *mut ::core::ffi::c_void; pub type IWMDeviceRegistration = *mut ::core::ffi::c_void; pub type IWMGetSecureChannel = *mut ::core::ffi::c_void; pub type IWMHeaderInfo = *mut ::core::ffi::c_void; pub type IWMHeaderInfo2 = *mut ::core::ffi::c_void; pub type IWMHeaderInfo3 = *mut ::core::ffi::c_void; pub type IWMIStreamProps = *mut ::core::ffi::c_void; pub type IWMImageInfo = *mut ::core::ffi::c_void; pub type IWMIndexer = *mut ::core::ffi::c_void; pub type IWMIndexer2 = *mut ::core::ffi::c_void; pub type IWMInputMediaProps = *mut ::core::ffi::c_void; pub type IWMLanguageList = *mut ::core::ffi::c_void; pub type IWMLicenseBackup = *mut ::core::ffi::c_void; pub type IWMLicenseRestore = *mut ::core::ffi::c_void; pub type IWMLicenseRevocationAgent = *mut ::core::ffi::c_void; pub type IWMMediaProps = *mut ::core::ffi::c_void; pub type IWMMetadataEditor = *mut ::core::ffi::c_void; pub type IWMMetadataEditor2 = *mut ::core::ffi::c_void; pub type IWMMutualExclusion = *mut ::core::ffi::c_void; pub type IWMMutualExclusion2 = *mut ::core::ffi::c_void; pub type IWMOutputMediaProps = *mut ::core::ffi::c_void; pub type IWMPacketSize = *mut ::core::ffi::c_void; pub type IWMPacketSize2 = *mut ::core::ffi::c_void; pub type IWMPlayerHook = *mut ::core::ffi::c_void; pub type IWMPlayerTimestampHook = *mut ::core::ffi::c_void; pub type IWMProfile = *mut ::core::ffi::c_void; pub type IWMProfile2 = *mut ::core::ffi::c_void; pub type IWMProfile3 = *mut ::core::ffi::c_void; pub type IWMProfileManager = *mut ::core::ffi::c_void; pub type IWMProfileManager2 = *mut ::core::ffi::c_void; pub type IWMProfileManagerLanguage = *mut ::core::ffi::c_void; pub type IWMPropertyVault = *mut ::core::ffi::c_void; pub type IWMProximityDetection = *mut ::core::ffi::c_void; pub type IWMReader = *mut ::core::ffi::c_void; pub type IWMReaderAccelerator = *mut ::core::ffi::c_void; pub type IWMReaderAdvanced = *mut ::core::ffi::c_void; pub type IWMReaderAdvanced2 = *mut ::core::ffi::c_void; pub type IWMReaderAdvanced3 = *mut ::core::ffi::c_void; pub type IWMReaderAdvanced4 = *mut ::core::ffi::c_void; pub type IWMReaderAdvanced5 = *mut ::core::ffi::c_void; pub type IWMReaderAdvanced6 = *mut ::core::ffi::c_void; pub type IWMReaderAllocatorEx = *mut ::core::ffi::c_void; pub type IWMReaderCallback = *mut ::core::ffi::c_void; pub type IWMReaderCallbackAdvanced = *mut ::core::ffi::c_void; pub type IWMReaderNetworkConfig = *mut ::core::ffi::c_void; pub type IWMReaderNetworkConfig2 = *mut ::core::ffi::c_void; pub type IWMReaderPlaylistBurn = *mut ::core::ffi::c_void; pub type IWMReaderStreamClock = *mut ::core::ffi::c_void; pub type IWMReaderTimecode = *mut ::core::ffi::c_void; pub type IWMReaderTypeNegotiation = *mut ::core::ffi::c_void; pub type IWMRegisterCallback = *mut ::core::ffi::c_void; pub type IWMRegisteredDevice = *mut ::core::ffi::c_void; pub type IWMSBufferAllocator = *mut ::core::ffi::c_void; pub type IWMSInternalAdminNetSource = *mut ::core::ffi::c_void; pub type IWMSInternalAdminNetSource2 = *mut ::core::ffi::c_void; pub type IWMSInternalAdminNetSource3 = *mut ::core::ffi::c_void; pub type IWMSecureChannel = *mut ::core::ffi::c_void; pub type IWMStatusCallback = *mut ::core::ffi::c_void; pub type IWMStreamConfig = *mut ::core::ffi::c_void; pub type IWMStreamConfig2 = *mut ::core::ffi::c_void; pub type IWMStreamConfig3 = *mut ::core::ffi::c_void; pub type IWMStreamList = *mut ::core::ffi::c_void; pub type IWMStreamPrioritization = *mut ::core::ffi::c_void; pub type IWMSyncReader = *mut ::core::ffi::c_void; pub type IWMSyncReader2 = *mut ::core::ffi::c_void; pub type IWMVideoMediaProps = *mut ::core::ffi::c_void; pub type IWMWatermarkInfo = *mut ::core::ffi::c_void; pub type IWMWriter = *mut ::core::ffi::c_void; pub type IWMWriterAdvanced = *mut ::core::ffi::c_void; pub type IWMWriterAdvanced2 = *mut ::core::ffi::c_void; pub type IWMWriterAdvanced3 = *mut ::core::ffi::c_void; pub type IWMWriterFileSink = *mut ::core::ffi::c_void; pub type IWMWriterFileSink2 = *mut ::core::ffi::c_void; pub type IWMWriterFileSink3 = *mut ::core::ffi::c_void; pub type IWMWriterNetworkSink = *mut ::core::ffi::c_void; pub type IWMWriterPostView = *mut ::core::ffi::c_void; pub type IWMWriterPostViewCallback = *mut ::core::ffi::c_void; pub type IWMWriterPreprocess = *mut ::core::ffi::c_void; pub type IWMWriterPushSink = *mut ::core::ffi::c_void; pub type IWMWriterSink = *mut ::core::ffi::c_void; pub type NETSOURCE_URLCREDPOLICY_SETTINGS = i32; pub const NETSOURCE_URLCREDPOLICY_SETTING_SILENTLOGONOK: NETSOURCE_URLCREDPOLICY_SETTINGS = 0i32; pub const NETSOURCE_URLCREDPOLICY_SETTING_MUSTPROMPTUSER: NETSOURCE_URLCREDPOLICY_SETTINGS = 1i32; pub const NETSOURCE_URLCREDPOLICY_SETTING_ANONYMOUSONLY: NETSOURCE_URLCREDPOLICY_SETTINGS = 2i32; pub type WEBSTREAM_SAMPLE_TYPE = i32; pub const WEBSTREAM_SAMPLE_TYPE_FILE: WEBSTREAM_SAMPLE_TYPE = 1i32; pub const WEBSTREAM_SAMPLE_TYPE_RENDER: WEBSTREAM_SAMPLE_TYPE = 2i32; #[repr(C)] pub struct WMDRM_IMPORT_INIT_STRUCT { pub dwVersion: u32, pub cbEncryptedSessionKeyMessage: u32, pub pbEncryptedSessionKeyMessage: *mut u8, pub cbEncryptedKeyMessage: u32, pub pbEncryptedKeyMessage: *mut u8, } impl ::core::marker::Copy for WMDRM_IMPORT_INIT_STRUCT {} impl ::core::clone::Clone for WMDRM_IMPORT_INIT_STRUCT { fn clone(&self) -> Self { *self } } pub const WMDRM_IMPORT_INIT_STRUCT_DEFINED: u32 = 1u32; pub const WMFORMAT_MPEG2Video: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3765272803, data2: 56134, data3: 4559, data4: [180, 209, 0, 128, 95, 108, 187, 234] }; pub const WMFORMAT_Script: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1552224498, data2: 57022, data3: 19623, data4: [187, 165, 240, 122, 16, 79, 141, 255], }; pub const WMFORMAT_VideoInfo: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 89694080, data2: 50006, data3: 4558, data4: [191, 1, 0, 170, 0, 85, 89, 90] }; pub const WMFORMAT_WaveFormatEx: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 89694081, data2: 50006, data3: 4558, data4: [191, 1, 0, 170, 0, 85, 89, 90] }; pub const WMFORMAT_WebStream: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3659426579, data2: 33625, data3: 16464, data4: [179, 152, 56, 142, 150, 91, 240, 12], }; pub const WMMEDIASUBTYPE_ACELPnet: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 304, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_Base: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 0, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_DRM: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 9, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_I420: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 808596553, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_IYUV: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1448433993, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_M4S2: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 844313677, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_MP3: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 85, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_MP43: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 859066445, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_MP4S: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1395937357, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_MPEG2_VIDEO: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3765272614, data2: 56134, data3: 4559, data4: [180, 209, 0, 128, 95, 108, 187, 234] }; pub const WMMEDIASUBTYPE_MSS1: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 827544397, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_MSS2: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 844321613, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_P422: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 842150992, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_PCM: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_RGB1: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3828804472, data2: 21071, data3: 4558, data4: [159, 83, 0, 32, 175, 11, 167, 112] }; pub const WMMEDIASUBTYPE_RGB24: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3828804477, data2: 21071, data3: 4558, data4: [159, 83, 0, 32, 175, 11, 167, 112] }; pub const WMMEDIASUBTYPE_RGB32: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3828804478, data2: 21071, data3: 4558, data4: [159, 83, 0, 32, 175, 11, 167, 112] }; pub const WMMEDIASUBTYPE_RGB4: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3828804473, data2: 21071, data3: 4558, data4: [159, 83, 0, 32, 175, 11, 167, 112] }; pub const WMMEDIASUBTYPE_RGB555: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3828804476, data2: 21071, data3: 4558, data4: [159, 83, 0, 32, 175, 11, 167, 112] }; pub const WMMEDIASUBTYPE_RGB565: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3828804475, data2: 21071, data3: 4558, data4: [159, 83, 0, 32, 175, 11, 167, 112] }; pub const WMMEDIASUBTYPE_RGB8: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3828804474, data2: 21071, data3: 4558, data4: [159, 83, 0, 32, 175, 11, 167, 112] }; pub const WMMEDIASUBTYPE_UYVY: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1498831189, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_VIDEOIMAGE: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 491406834, data2: 58870, data3: 19268, data4: [131, 136, 240, 174, 92, 14, 12, 55] }; pub const WMMEDIASUBTYPE_WMAudioV2: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 353, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMAudioV7: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 353, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMAudioV8: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 353, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMAudioV9: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 354, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMAudio_Lossless: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 355, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMSP1: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 10, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMSP2: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 11, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMV1: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 827739479, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMV2: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 844516695, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMV3: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 861293911, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMVA: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1096174935, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WMVP: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1347833175, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WVC1: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 826496599, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WVP2: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 844125783, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_WebStream: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 2002933716, data2: 50727, data3: 16843, data4: [143, 129, 122, 199, 255, 28, 64, 204], }; pub const WMMEDIASUBTYPE_YUY2: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 844715353, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_YV12: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 842094169, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_YVU9: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 961893977, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIASUBTYPE_YVYU: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1431918169, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIATYPE_Audio: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1935963489, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIATYPE_FileTransfer: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3655628153, data2: 37646, data3: 17447, data4: [173, 252, 173, 128, 242, 144, 228, 112], }; pub const WMMEDIATYPE_Image: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 883232728, data2: 35493, data3: 17286, data4: [129, 254, 160, 239, 224, 72, 142, 49], }; pub const WMMEDIATYPE_Script: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1935895908, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; pub const WMMEDIATYPE_Text: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 2612666023, data2: 23218, data3: 18473, data4: [186, 87, 9, 64, 32, 155, 207, 62] }; pub const WMMEDIATYPE_Video: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1935960438, data2: 0, data3: 16, data4: [128, 0, 0, 170, 0, 56, 155, 113] }; #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] pub struct WMMPEG2VIDEOINFO { pub hdr: WMVIDEOINFOHEADER2, pub dwStartTimeCode: u32, pub cbSequenceHeader: u32, pub dwProfile: u32, pub dwLevel: u32, pub dwFlags: u32, pub dwSequenceHeader: [u32; 1], } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] impl ::core::marker::Copy for WMMPEG2VIDEOINFO {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] impl ::core::clone::Clone for WMMPEG2VIDEOINFO { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct WMSCRIPTFORMAT { pub scriptType: ::windows_sys::core::GUID, } impl ::core::marker::Copy for WMSCRIPTFORMAT {} impl ::core::clone::Clone for WMSCRIPTFORMAT { fn clone(&self) -> Self { *self } } pub const WMSCRIPTTYPE_TwoStrings: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 2196998768, data2: 49823, data3: 4561, data4: [151, 173, 0, 160, 201, 94, 168, 80] }; pub type WMT_ATTR_DATATYPE = i32; pub const WMT_TYPE_DWORD: WMT_ATTR_DATATYPE = 0i32; pub const WMT_TYPE_STRING: WMT_ATTR_DATATYPE = 1i32; pub const WMT_TYPE_BINARY: WMT_ATTR_DATATYPE = 2i32; pub const WMT_TYPE_BOOL: WMT_ATTR_DATATYPE = 3i32; pub const WMT_TYPE_QWORD: WMT_ATTR_DATATYPE = 4i32; pub const WMT_TYPE_WORD: WMT_ATTR_DATATYPE = 5i32; pub const WMT_TYPE_GUID: WMT_ATTR_DATATYPE = 6i32; pub type WMT_ATTR_IMAGETYPE = i32; pub const WMT_IMAGETYPE_BITMAP: WMT_ATTR_IMAGETYPE = 1i32; pub const WMT_IMAGETYPE_JPEG: WMT_ATTR_IMAGETYPE = 2i32; pub const WMT_IMAGETYPE_GIF: WMT_ATTR_IMAGETYPE = 3i32; #[repr(C)] pub struct WMT_BUFFER_SEGMENT { pub pBuffer: INSSBuffer, pub cbOffset: u32, pub cbLength: u32, } impl ::core::marker::Copy for WMT_BUFFER_SEGMENT {} impl ::core::clone::Clone for WMT_BUFFER_SEGMENT { fn clone(&self) -> Self { *self } } pub type WMT_CODEC_INFO_TYPE = i32; pub const WMT_CODECINFO_AUDIO: WMT_CODEC_INFO_TYPE = 0i32; pub const WMT_CODECINFO_VIDEO: WMT_CODEC_INFO_TYPE = 1i32; pub const WMT_CODECINFO_UNKNOWN: WMT_CODEC_INFO_TYPE = -1i32; #[repr(C)] pub struct WMT_COLORSPACEINFO_EXTENSION_DATA { pub ucColorPrimaries: u8, pub ucColorTransferChar: u8, pub ucColorMatrixCoef: u8, } impl ::core::marker::Copy for WMT_COLORSPACEINFO_EXTENSION_DATA {} impl ::core::clone::Clone for WMT_COLORSPACEINFO_EXTENSION_DATA { fn clone(&self) -> Self { *self } } pub type WMT_CREDENTIAL_FLAGS = i32; pub const WMT_CREDENTIAL_SAVE: WMT_CREDENTIAL_FLAGS = 1i32; pub const WMT_CREDENTIAL_DONT_CACHE: WMT_CREDENTIAL_FLAGS = 2i32; pub const WMT_CREDENTIAL_CLEAR_TEXT: WMT_CREDENTIAL_FLAGS = 4i32; pub const WMT_CREDENTIAL_PROXY: WMT_CREDENTIAL_FLAGS = 8i32; pub const WMT_CREDENTIAL_ENCRYPT: WMT_CREDENTIAL_FLAGS = 16i32; pub const WMT_DMOCATEGORY_AUDIO_WATERMARK: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1696734298, data2: 64117, data3: 19257, data4: [181, 12, 6, 195, 54, 182, 163, 239] }; pub const WMT_DMOCATEGORY_VIDEO_WATERMARK: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 410831138, data2: 36604, data3: 17412, data4: [157, 175, 99, 244, 131, 13, 241, 188], }; pub type WMT_DRMLA_TRUST = i32; pub const WMT_DRMLA_UNTRUSTED: WMT_DRMLA_TRUST = 0i32; pub const WMT_DRMLA_TRUSTED: WMT_DRMLA_TRUST = 1i32; pub const WMT_DRMLA_TAMPERED: WMT_DRMLA_TRUST = 2i32; #[repr(C)] pub struct WMT_FILESINK_DATA_UNIT { pub packetHeaderBuffer: WMT_BUFFER_SEGMENT, pub cPayloads: u32, pub pPayloadHeaderBuffers: *mut WMT_BUFFER_SEGMENT, pub cPayloadDataFragments: u32, pub pPayloadDataFragments: *mut WMT_PAYLOAD_FRAGMENT, } impl ::core::marker::Copy for WMT_FILESINK_DATA_UNIT {} impl ::core::clone::Clone for WMT_FILESINK_DATA_UNIT { fn clone(&self) -> Self { *self } } pub type WMT_FILESINK_MODE = i32; pub const WMT_FM_SINGLE_BUFFERS: WMT_FILESINK_MODE = 1i32; pub const WMT_FM_FILESINK_DATA_UNITS: WMT_FILESINK_MODE = 2i32; pub const WMT_FM_FILESINK_UNBUFFERED: WMT_FILESINK_MODE = 4i32; pub type WMT_IMAGE_TYPE = i32; pub const WMT_IT_NONE: WMT_IMAGE_TYPE = 0i32; pub const WMT_IT_BITMAP: WMT_IMAGE_TYPE = 1i32; pub const WMT_IT_JPEG: WMT_IMAGE_TYPE = 2i32; pub const WMT_IT_GIF: WMT_IMAGE_TYPE = 3i32; pub type WMT_INDEXER_TYPE = i32; pub const WMT_IT_PRESENTATION_TIME: WMT_INDEXER_TYPE = 0i32; pub const WMT_IT_FRAME_NUMBERS: WMT_INDEXER_TYPE = 1i32; pub const WMT_IT_TIMECODE: WMT_INDEXER_TYPE = 2i32; pub type WMT_INDEX_TYPE = i32; pub const WMT_IT_NEAREST_DATA_UNIT: WMT_INDEX_TYPE = 1i32; pub const WMT_IT_NEAREST_OBJECT: WMT_INDEX_TYPE = 2i32; pub const WMT_IT_NEAREST_CLEAN_POINT: WMT_INDEX_TYPE = 3i32; pub type WMT_MUSICSPEECH_CLASS_MODE = i32; pub const WMT_MS_CLASS_MUSIC: WMT_MUSICSPEECH_CLASS_MODE = 0i32; pub const WMT_MS_CLASS_SPEECH: WMT_MUSICSPEECH_CLASS_MODE = 1i32; pub const WMT_MS_CLASS_MIXED: WMT_MUSICSPEECH_CLASS_MODE = 2i32; pub type WMT_NET_PROTOCOL = i32; pub const WMT_PROTOCOL_HTTP: WMT_NET_PROTOCOL = 0i32; pub type WMT_OFFSET_FORMAT = i32; pub const WMT_OFFSET_FORMAT_100NS: WMT_OFFSET_FORMAT = 0i32; pub const WMT_OFFSET_FORMAT_FRAME_NUMBERS: WMT_OFFSET_FORMAT = 1i32; pub const WMT_OFFSET_FORMAT_PLAYLIST_OFFSET: WMT_OFFSET_FORMAT = 2i32; pub const WMT_OFFSET_FORMAT_TIMECODE: WMT_OFFSET_FORMAT = 3i32; pub const WMT_OFFSET_FORMAT_100NS_APPROXIMATE: WMT_OFFSET_FORMAT = 4i32; #[repr(C)] pub struct WMT_PAYLOAD_FRAGMENT { pub dwPayloadIndex: u32, pub segmentData: WMT_BUFFER_SEGMENT, } impl ::core::marker::Copy for WMT_PAYLOAD_FRAGMENT {} impl ::core::clone::Clone for WMT_PAYLOAD_FRAGMENT { fn clone(&self) -> Self { *self } } pub type WMT_PLAY_MODE = i32; pub const WMT_PLAY_MODE_AUTOSELECT: WMT_PLAY_MODE = 0i32; pub const WMT_PLAY_MODE_LOCAL: WMT_PLAY_MODE = 1i32; pub const WMT_PLAY_MODE_DOWNLOAD: WMT_PLAY_MODE = 2i32; pub const WMT_PLAY_MODE_STREAMING: WMT_PLAY_MODE = 3i32; pub type WMT_PROXY_SETTINGS = i32; pub const WMT_PROXY_SETTING_NONE: WMT_PROXY_SETTINGS = 0i32; pub const WMT_PROXY_SETTING_MANUAL: WMT_PROXY_SETTINGS = 1i32; pub const WMT_PROXY_SETTING_AUTO: WMT_PROXY_SETTINGS = 2i32; pub const WMT_PROXY_SETTING_BROWSER: WMT_PROXY_SETTINGS = 3i32; pub const WMT_PROXY_SETTING_MAX: WMT_PROXY_SETTINGS = 4i32; pub type WMT_RIGHTS = i32; pub const WMT_RIGHT_PLAYBACK: WMT_RIGHTS = 1i32; pub const WMT_RIGHT_COPY_TO_NON_SDMI_DEVICE: WMT_RIGHTS = 2i32; pub const WMT_RIGHT_COPY_TO_CD: WMT_RIGHTS = 8i32; pub const WMT_RIGHT_COPY_TO_SDMI_DEVICE: WMT_RIGHTS = 16i32; pub const WMT_RIGHT_ONE_TIME: WMT_RIGHTS = 32i32; pub const WMT_RIGHT_SAVE_STREAM_PROTECTED: WMT_RIGHTS = 64i32; pub const WMT_RIGHT_COPY: WMT_RIGHTS = 128i32; pub const WMT_RIGHT_COLLABORATIVE_PLAY: WMT_RIGHTS = 256i32; pub const WMT_RIGHT_SDMI_TRIGGER: WMT_RIGHTS = 65536i32; pub const WMT_RIGHT_SDMI_NOMORECOPIES: WMT_RIGHTS = 131072i32; pub type WMT_STATUS = i32; pub const WMT_ERROR: WMT_STATUS = 0i32; pub const WMT_OPENED: WMT_STATUS = 1i32; pub const WMT_BUFFERING_START: WMT_STATUS = 2i32; pub const WMT_BUFFERING_STOP: WMT_STATUS = 3i32; pub const WMT_EOF: WMT_STATUS = 4i32; pub const WMT_END_OF_FILE: WMT_STATUS = 4i32; pub const WMT_END_OF_SEGMENT: WMT_STATUS = 5i32; pub const WMT_END_OF_STREAMING: WMT_STATUS = 6i32; pub const WMT_LOCATING: WMT_STATUS = 7i32; pub const WMT_CONNECTING: WMT_STATUS = 8i32; pub const WMT_NO_RIGHTS: WMT_STATUS = 9i32; pub const WMT_MISSING_CODEC: WMT_STATUS = 10i32; pub const WMT_STARTED: WMT_STATUS = 11i32; pub const WMT_STOPPED: WMT_STATUS = 12i32; pub const WMT_CLOSED: WMT_STATUS = 13i32; pub const WMT_STRIDING: WMT_STATUS = 14i32; pub const WMT_TIMER: WMT_STATUS = 15i32; pub const WMT_INDEX_PROGRESS: WMT_STATUS = 16i32; pub const WMT_SAVEAS_START: WMT_STATUS = 17i32; pub const WMT_SAVEAS_STOP: WMT_STATUS = 18i32; pub const WMT_NEW_SOURCEFLAGS: WMT_STATUS = 19i32; pub const WMT_NEW_METADATA: WMT_STATUS = 20i32; pub const WMT_BACKUPRESTORE_BEGIN: WMT_STATUS = 21i32; pub const WMT_SOURCE_SWITCH: WMT_STATUS = 22i32; pub const WMT_ACQUIRE_LICENSE: WMT_STATUS = 23i32; pub const WMT_INDIVIDUALIZE: WMT_STATUS = 24i32; pub const WMT_NEEDS_INDIVIDUALIZATION: WMT_STATUS = 25i32; pub const WMT_NO_RIGHTS_EX: WMT_STATUS = 26i32; pub const WMT_BACKUPRESTORE_END: WMT_STATUS = 27i32; pub const WMT_BACKUPRESTORE_CONNECTING: WMT_STATUS = 28i32; pub const WMT_BACKUPRESTORE_DISCONNECTING: WMT_STATUS = 29i32; pub const WMT_ERROR_WITHURL: WMT_STATUS = 30i32; pub const WMT_RESTRICTED_LICENSE: WMT_STATUS = 31i32; pub const WMT_CLIENT_CONNECT: WMT_STATUS = 32i32; pub const WMT_CLIENT_DISCONNECT: WMT_STATUS = 33i32; pub const WMT_NATIVE_OUTPUT_PROPS_CHANGED: WMT_STATUS = 34i32; pub const WMT_RECONNECT_START: WMT_STATUS = 35i32; pub const WMT_RECONNECT_END: WMT_STATUS = 36i32; pub const WMT_CLIENT_CONNECT_EX: WMT_STATUS = 37i32; pub const WMT_CLIENT_DISCONNECT_EX: WMT_STATUS = 38i32; pub const WMT_SET_FEC_SPAN: WMT_STATUS = 39i32; pub const WMT_PREROLL_READY: WMT_STATUS = 40i32; pub const WMT_PREROLL_COMPLETE: WMT_STATUS = 41i32; pub const WMT_CLIENT_PROPERTIES: WMT_STATUS = 42i32; pub const WMT_LICENSEURL_SIGNATURE_STATE: WMT_STATUS = 43i32; pub const WMT_INIT_PLAYLIST_BURN: WMT_STATUS = 44i32; pub const WMT_TRANSCRYPTOR_INIT: WMT_STATUS = 45i32; pub const WMT_TRANSCRYPTOR_SEEKED: WMT_STATUS = 46i32; pub const WMT_TRANSCRYPTOR_READ: WMT_STATUS = 47i32; pub const WMT_TRANSCRYPTOR_CLOSED: WMT_STATUS = 48i32; pub const WMT_PROXIMITY_RESULT: WMT_STATUS = 49i32; pub const WMT_PROXIMITY_COMPLETED: WMT_STATUS = 50i32; pub const WMT_CONTENT_ENABLER: WMT_STATUS = 51i32; pub type WMT_STORAGE_FORMAT = i32; pub const WMT_Storage_Format_MP3: WMT_STORAGE_FORMAT = 0i32; pub const WMT_Storage_Format_V1: WMT_STORAGE_FORMAT = 1i32; pub type WMT_STREAM_SELECTION = i32; pub const WMT_OFF: WMT_STREAM_SELECTION = 0i32; pub const WMT_CLEANPOINT_ONLY: WMT_STREAM_SELECTION = 1i32; pub const WMT_ON: WMT_STREAM_SELECTION = 2i32; #[repr(C, packed(2))] pub struct WMT_TIMECODE_EXTENSION_DATA { pub wRange: u16, pub dwTimecode: u32, pub dwUserbits: u32, pub dwAmFlags: u32, } impl ::core::marker::Copy for WMT_TIMECODE_EXTENSION_DATA {} impl ::core::clone::Clone for WMT_TIMECODE_EXTENSION_DATA { fn clone(&self) -> Self { *self } } pub type WMT_TIMECODE_FRAMERATE = i32; pub const WMT_TIMECODE_FRAMERATE_30: WMT_TIMECODE_FRAMERATE = 0i32; pub const WMT_TIMECODE_FRAMERATE_30DROP: WMT_TIMECODE_FRAMERATE = 1i32; pub const WMT_TIMECODE_FRAMERATE_25: WMT_TIMECODE_FRAMERATE = 2i32; pub const WMT_TIMECODE_FRAMERATE_24: WMT_TIMECODE_FRAMERATE = 3i32; pub type WMT_TRANSPORT_TYPE = i32; pub const WMT_Transport_Type_Unreliable: WMT_TRANSPORT_TYPE = 0i32; pub const WMT_Transport_Type_Reliable: WMT_TRANSPORT_TYPE = 1i32; pub type WMT_VERSION = i32; pub const WMT_VER_4_0: WMT_VERSION = 262144i32; pub const WMT_VER_7_0: WMT_VERSION = 458752i32; pub const WMT_VER_8_0: WMT_VERSION = 524288i32; pub const WMT_VER_9_0: WMT_VERSION = 589824i32; pub const WMT_VIDEOIMAGE_INTEGER_DENOMINATOR: i32 = 65536i32; pub const WMT_VIDEOIMAGE_MAGIC_NUMBER: u32 = 491406834u32; pub const WMT_VIDEOIMAGE_MAGIC_NUMBER_2: u32 = 491406835u32; #[repr(C)] pub struct WMT_VIDEOIMAGE_SAMPLE { pub dwMagic: u32, pub cbStruct: u32, pub dwControlFlags: u32, pub dwInputFlagsCur: u32, pub lCurMotionXtoX: i32, pub lCurMotionYtoX: i32, pub lCurMotionXoffset: i32, pub lCurMotionXtoY: i32, pub lCurMotionYtoY: i32, pub lCurMotionYoffset: i32, pub lCurBlendCoef1: i32, pub lCurBlendCoef2: i32, pub dwInputFlagsPrev: u32, pub lPrevMotionXtoX: i32, pub lPrevMotionYtoX: i32, pub lPrevMotionXoffset: i32, pub lPrevMotionXtoY: i32, pub lPrevMotionYtoY: i32, pub lPrevMotionYoffset: i32, pub lPrevBlendCoef1: i32, pub lPrevBlendCoef2: i32, } impl ::core::marker::Copy for WMT_VIDEOIMAGE_SAMPLE {} impl ::core::clone::Clone for WMT_VIDEOIMAGE_SAMPLE { fn clone(&self) -> Self { *self } } #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WMT_VIDEOIMAGE_SAMPLE2 { pub dwMagic: u32, pub dwStructSize: u32, pub dwControlFlags: u32, pub dwViewportWidth: u32, pub dwViewportHeight: u32, pub dwCurrImageWidth: u32, pub dwCurrImageHeight: u32, pub fCurrRegionX0: f32, pub fCurrRegionY0: f32, pub fCurrRegionWidth: f32, pub fCurrRegionHeight: f32, pub fCurrBlendCoef: f32, pub dwPrevImageWidth: u32, pub dwPrevImageHeight: u32, pub fPrevRegionX0: f32, pub fPrevRegionY0: f32, pub fPrevRegionWidth: f32, pub fPrevRegionHeight: f32, pub fPrevBlendCoef: f32, pub dwEffectType: u32, pub dwNumEffectParas: u32, pub fEffectPara0: f32, pub fEffectPara1: f32, pub fEffectPara2: f32, pub fEffectPara3: f32, pub fEffectPara4: f32, pub bKeepPrevImage: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WMT_VIDEOIMAGE_SAMPLE2 {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WMT_VIDEOIMAGE_SAMPLE2 { fn clone(&self) -> Self { *self } } pub const WMT_VIDEOIMAGE_SAMPLE_ADV_BLENDING: u32 = 8u32; pub const WMT_VIDEOIMAGE_SAMPLE_BLENDING: u32 = 4u32; pub const WMT_VIDEOIMAGE_SAMPLE_INPUT_FRAME: u32 = 1u32; pub const WMT_VIDEOIMAGE_SAMPLE_MOTION: u32 = 1u32; pub const WMT_VIDEOIMAGE_SAMPLE_OUTPUT_FRAME: u32 = 2u32; pub const WMT_VIDEOIMAGE_SAMPLE_ROTATION: u32 = 2u32; pub const WMT_VIDEOIMAGE_SAMPLE_USES_CURRENT_INPUT_FRAME: u32 = 4u32; pub const WMT_VIDEOIMAGE_SAMPLE_USES_PREVIOUS_INPUT_FRAME: u32 = 8u32; pub const WMT_VIDEOIMAGE_TRANSITION_BOW_TIE: u32 = 11u32; pub const WMT_VIDEOIMAGE_TRANSITION_CIRCLE: u32 = 12u32; pub const WMT_VIDEOIMAGE_TRANSITION_CROSS_FADE: u32 = 13u32; pub const WMT_VIDEOIMAGE_TRANSITION_DIAGONAL: u32 = 14u32; pub const WMT_VIDEOIMAGE_TRANSITION_DIAMOND: u32 = 15u32; pub const WMT_VIDEOIMAGE_TRANSITION_FADE_TO_COLOR: u32 = 16u32; pub const WMT_VIDEOIMAGE_TRANSITION_FILLED_V: u32 = 17u32; pub const WMT_VIDEOIMAGE_TRANSITION_FLIP: u32 = 18u32; pub const WMT_VIDEOIMAGE_TRANSITION_INSET: u32 = 19u32; pub const WMT_VIDEOIMAGE_TRANSITION_IRIS: u32 = 20u32; pub const WMT_VIDEOIMAGE_TRANSITION_PAGE_ROLL: u32 = 21u32; pub const WMT_VIDEOIMAGE_TRANSITION_RECTANGLE: u32 = 23u32; pub const WMT_VIDEOIMAGE_TRANSITION_REVEAL: u32 = 24u32; pub const WMT_VIDEOIMAGE_TRANSITION_SLIDE: u32 = 27u32; pub const WMT_VIDEOIMAGE_TRANSITION_SPLIT: u32 = 29u32; pub const WMT_VIDEOIMAGE_TRANSITION_STAR: u32 = 30u32; pub const WMT_VIDEOIMAGE_TRANSITION_WHEEL: u32 = 31u32; #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WMT_WATERMARK_ENTRY { pub wmetType: WMT_WATERMARK_ENTRY_TYPE, pub clsid: ::windows_sys::core::GUID, pub cbDisplayName: u32, pub pwszDisplayName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WMT_WATERMARK_ENTRY {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WMT_WATERMARK_ENTRY { fn clone(&self) -> Self { *self } } pub type WMT_WATERMARK_ENTRY_TYPE = i32; pub const WMT_WMETYPE_AUDIO: WMT_WATERMARK_ENTRY_TYPE = 1i32; pub const WMT_WMETYPE_VIDEO: WMT_WATERMARK_ENTRY_TYPE = 2i32; #[repr(C)] pub struct WMT_WEBSTREAM_FORMAT { pub cbSize: u16, pub cbSampleHeaderFixedData: u16, pub wVersion: u16, pub wReserved: u16, } impl ::core::marker::Copy for WMT_WEBSTREAM_FORMAT {} impl ::core::clone::Clone for WMT_WEBSTREAM_FORMAT { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct WMT_WEBSTREAM_SAMPLE_HEADER { pub cbLength: u16, pub wPart: u16, pub cTotalParts: u16, pub wSampleType: u16, pub wszURL: [u16; 1], } impl ::core::marker::Copy for WMT_WEBSTREAM_SAMPLE_HEADER {} impl ::core::clone::Clone for WMT_WEBSTREAM_SAMPLE_HEADER { fn clone(&self) -> Self { *self } } #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] pub struct WMVIDEOINFOHEADER { pub rcSource: super::super::Foundation::RECT, pub rcTarget: super::super::Foundation::RECT, pub dwBitRate: u32, pub dwBitErrorRate: u32, pub AvgTimePerFrame: i64, pub bmiHeader: super::super::Graphics::Gdi::BITMAPINFOHEADER, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] impl ::core::marker::Copy for WMVIDEOINFOHEADER {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] impl ::core::clone::Clone for WMVIDEOINFOHEADER { fn clone(&self) -> Self { *self } } #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] pub struct WMVIDEOINFOHEADER2 { pub rcSource: super::super::Foundation::RECT, pub rcTarget: super::super::Foundation::RECT, pub dwBitRate: u32, pub dwBitErrorRate: u32, pub AvgTimePerFrame: i64, pub dwInterlaceFlags: u32, pub dwCopyProtectFlags: u32, pub dwPictAspectRatioX: u32, pub dwPictAspectRatioY: u32, pub dwReserved1: u32, pub dwReserved2: u32, pub bmiHeader: super::super::Graphics::Gdi::BITMAPINFOHEADER, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] impl ::core::marker::Copy for WMVIDEOINFOHEADER2 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] impl ::core::clone::Clone for WMVIDEOINFOHEADER2 { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct WM_ADDRESS_ACCESSENTRY { pub dwIPAddress: u32, pub dwMask: u32, } impl ::core::marker::Copy for WM_ADDRESS_ACCESSENTRY {} impl ::core::clone::Clone for WM_ADDRESS_ACCESSENTRY { fn clone(&self) -> Self { *self } } pub type WM_AETYPE = i32; pub const WM_AETYPE_INCLUDE: WM_AETYPE = 105i32; pub const WM_AETYPE_EXCLUDE: WM_AETYPE = 101i32; #[repr(C)] pub struct WM_CLIENT_PROPERTIES { pub dwIPAddress: u32, pub dwPort: u32, } impl ::core::marker::Copy for WM_CLIENT_PROPERTIES {} impl ::core::clone::Clone for WM_CLIENT_PROPERTIES { fn clone(&self) -> Self { *self } } #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WM_CLIENT_PROPERTIES_EX { pub cbSize: u32, pub pwszIPAddress: super::super::Foundation::PWSTR, pub pwszPort: super::super::Foundation::PWSTR, pub pwszDNSName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WM_CLIENT_PROPERTIES_EX {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WM_CLIENT_PROPERTIES_EX { fn clone(&self) -> Self { *self } } pub const WM_CL_INTERLACED420: u32 = 0u32; pub const WM_CL_PROGRESSIVE420: u32 = 1u32; pub const WM_CT_BOTTOM_FIELD_FIRST: u32 = 32u32; pub const WM_CT_INTERLACED: u32 = 128u32; pub const WM_CT_REPEAT_FIRST_FIELD: u32 = 16u32; pub const WM_CT_TOP_FIELD_FIRST: u32 = 64u32; pub type WM_DM_INTERLACED_TYPE = i32; pub const WM_DM_NOTINTERLACED: WM_DM_INTERLACED_TYPE = 0i32; pub const WM_DM_DEINTERLACE_NORMAL: WM_DM_INTERLACED_TYPE = 1i32; pub const WM_DM_DEINTERLACE_HALFSIZE: WM_DM_INTERLACED_TYPE = 2i32; pub const WM_DM_DEINTERLACE_HALFSIZEDOUBLERATE: WM_DM_INTERLACED_TYPE = 3i32; pub const WM_DM_DEINTERLACE_INVERSETELECINE: WM_DM_INTERLACED_TYPE = 4i32; pub const WM_DM_DEINTERLACE_VERTICALHALFSIZEDOUBLERATE: WM_DM_INTERLACED_TYPE = 5i32; pub type WM_DM_IT_FIRST_FRAME_COHERENCY = i32; pub const WM_DM_IT_DISABLE_COHERENT_MODE: WM_DM_IT_FIRST_FRAME_COHERENCY = 0i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_AA_TOP: WM_DM_IT_FIRST_FRAME_COHERENCY = 1i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BB_TOP: WM_DM_IT_FIRST_FRAME_COHERENCY = 2i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BC_TOP: WM_DM_IT_FIRST_FRAME_COHERENCY = 3i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_CD_TOP: WM_DM_IT_FIRST_FRAME_COHERENCY = 4i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_DD_TOP: WM_DM_IT_FIRST_FRAME_COHERENCY = 5i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_AA_BOTTOM: WM_DM_IT_FIRST_FRAME_COHERENCY = 6i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BB_BOTTOM: WM_DM_IT_FIRST_FRAME_COHERENCY = 7i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BC_BOTTOM: WM_DM_IT_FIRST_FRAME_COHERENCY = 8i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_CD_BOTTOM: WM_DM_IT_FIRST_FRAME_COHERENCY = 9i32; pub const WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_DD_BOTTOM: WM_DM_IT_FIRST_FRAME_COHERENCY = 10i32; #[repr(C, packed(1))] pub struct WM_LEAKY_BUCKET_PAIR { pub dwBitrate: u32, pub msBufferWindow: u32, } impl ::core::marker::Copy for WM_LEAKY_BUCKET_PAIR {} impl ::core::clone::Clone for WM_LEAKY_BUCKET_PAIR { fn clone(&self) -> Self { *self } } pub const WM_MAX_STREAMS: u32 = 63u32; pub const WM_MAX_VIDEO_STREAMS: u32 = 63u32; #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WM_MEDIA_TYPE { pub majortype: ::windows_sys::core::GUID, pub subtype: ::windows_sys::core::GUID, pub bFixedSizeSamples: super::super::Foundation::BOOL, pub bTemporalCompression: super::super::Foundation::BOOL, pub lSampleSize: u32, pub formattype: ::windows_sys::core::GUID, pub pUnk: ::windows_sys::core::IUnknown, pub cbFormat: u32, pub pbFormat: *mut u8, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WM_MEDIA_TYPE {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WM_MEDIA_TYPE { fn clone(&self) -> Self { *self } } #[repr(C, packed(1))] #[cfg(feature = "Win32_Foundation")] pub struct WM_PICTURE { pub pwszMIMEType: super::super::Foundation::PWSTR, pub bPictureType: u8, pub pwszDescription: super::super::Foundation::PWSTR, pub dwDataLen: u32, pub pbData: *mut u8, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WM_PICTURE {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WM_PICTURE { fn clone(&self) -> Self { *self } } pub type WM_PLAYBACK_DRC_LEVEL = i32; pub const WM_PLAYBACK_DRC_HIGH: WM_PLAYBACK_DRC_LEVEL = 0i32; pub const WM_PLAYBACK_DRC_MEDIUM: WM_PLAYBACK_DRC_LEVEL = 1i32; pub const WM_PLAYBACK_DRC_LOW: WM_PLAYBACK_DRC_LEVEL = 2i32; #[repr(C)] pub struct WM_PORT_NUMBER_RANGE { pub wPortBegin: u16, pub wPortEnd: u16, } impl ::core::marker::Copy for WM_PORT_NUMBER_RANGE {} impl ::core::clone::Clone for WM_PORT_NUMBER_RANGE { fn clone(&self) -> Self { *self } } #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WM_READER_CLIENTINFO { pub cbSize: u32, pub wszLang: super::super::Foundation::PWSTR, pub wszBrowserUserAgent: super::super::Foundation::PWSTR, pub wszBrowserWebPage: super::super::Foundation::PWSTR, pub qwReserved: u64, pub pReserved: *mut super::super::Foundation::LPARAM, pub wszHostExe: super::super::Foundation::PWSTR, pub qwHostVersion: u64, pub wszPlayerUserAgent: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WM_READER_CLIENTINFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WM_READER_CLIENTINFO { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct WM_READER_STATISTICS { pub cbSize: u32, pub dwBandwidth: u32, pub cPacketsReceived: u32, pub cPacketsRecovered: u32, pub cPacketsLost: u32, pub wQuality: u16, } impl ::core::marker::Copy for WM_READER_STATISTICS {} impl ::core::clone::Clone for WM_READER_STATISTICS { fn clone(&self) -> Self { *self } } pub type WM_SFEX_TYPE = i32; pub const WM_SFEX_NOTASYNCPOINT: WM_SFEX_TYPE = 2i32; pub const WM_SFEX_DATALOSS: WM_SFEX_TYPE = 4i32; pub type WM_SF_TYPE = i32; pub const WM_SF_CLEANPOINT: WM_SF_TYPE = 1i32; pub const WM_SF_DISCONTINUITY: WM_SF_TYPE = 2i32; pub const WM_SF_DATALOSS: WM_SF_TYPE = 4i32; #[repr(C, packed(2))] #[cfg(feature = "Win32_Foundation")] pub struct WM_STREAM_PRIORITY_RECORD { pub wStreamNumber: u16, pub fMandatory: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WM_STREAM_PRIORITY_RECORD {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WM_STREAM_PRIORITY_RECORD { fn clone(&self) -> Self { *self } } #[repr(C, packed(1))] pub struct WM_STREAM_TYPE_INFO { pub guidMajorType: ::windows_sys::core::GUID, pub cbFormat: u32, } impl ::core::marker::Copy for WM_STREAM_TYPE_INFO {} impl ::core::clone::Clone for WM_STREAM_TYPE_INFO { fn clone(&self) -> Self { *self } } #[repr(C, packed(1))] #[cfg(feature = "Win32_Foundation")] pub struct WM_SYNCHRONISED_LYRICS { pub bTimeStampFormat: u8, pub bContentType: u8, pub pwszContentDescriptor: super::super::Foundation::PWSTR, pub dwLyricsLen: u32, pub pbLyrics: *mut u8, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WM_SYNCHRONISED_LYRICS {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WM_SYNCHRONISED_LYRICS { fn clone(&self) -> Self { *self } } pub const WM_SampleExtensionGUID_ChromaLocation: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1281019040, data2: 37494, data3: 19244, data4: [158, 76, 160, 237, 239, 221, 33, 126], }; pub const WM_SampleExtensionGUID_ColorSpaceInfo: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 4154120790, data2: 12523, data3: 20267, data4: [159, 122, 242, 75, 19, 154, 17, 87] }; pub const WM_SampleExtensionGUID_ContentType: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3583040544, data2: 1980, data3: 17260, data4: [156, 247, 243, 187, 251, 241, 164, 220], }; pub const WM_SampleExtensionGUID_FileName: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3781553166, data2: 6637, data3: 17879, data4: [180, 167, 37, 203, 209, 226, 142, 155], }; pub const WM_SampleExtensionGUID_OutputCleanPoint: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 4146740335, data2: 28340, data3: 20156, data4: [177, 146, 9, 173, 151, 89, 232, 40] }; pub const WM_SampleExtensionGUID_PixelAspectRatio: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 455009620, data2: 63978, data3: 19400, data4: [130, 26, 55, 107, 116, 228, 196, 184], }; pub const WM_SampleExtensionGUID_SampleDuration: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 3334313040, data2: 34431, data3: 18695, data4: [131, 163, 199, 121, 33, 183, 51, 173], }; pub const WM_SampleExtensionGUID_SampleProtectionSalt: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1409539822, data2: 47598, data3: 17295, data4: [170, 131, 56, 4, 153, 126, 86, 157] }; pub const WM_SampleExtensionGUID_Timecode: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 966104556, data2: 34407, data3: 20013, data4: [143, 219, 152, 129, 76, 231, 108, 30], }; pub const WM_SampleExtensionGUID_UserDataInfo: ::windows_sys::core::GUID = ::windows_sys::core::GUID { data1: 1932244218, data2: 30910, data3: 17737, data4: [153, 189, 2, 219, 26, 85, 183, 168] }; pub const WM_SampleExtension_ChromaLocation_Size: u32 = 1u32; pub const WM_SampleExtension_ColorSpaceInfo_Size: u32 = 3u32; pub const WM_SampleExtension_ContentType_Size: u32 = 1u32; pub const WM_SampleExtension_PixelAspectRatio_Size: u32 = 2u32; pub const WM_SampleExtension_SampleDuration_Size: u32 = 2u32; pub const WM_SampleExtension_Timecode_Size: u32 = 14u32; #[repr(C, packed(1))] #[cfg(feature = "Win32_Foundation")] pub struct WM_USER_TEXT { pub pwszDescription: super::super::Foundation::PWSTR, pub pwszText: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WM_USER_TEXT {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WM_USER_TEXT { fn clone(&self) -> Self { *self } } #[repr(C, packed(1))] #[cfg(feature = "Win32_Foundation")] pub struct WM_USER_WEB_URL { pub pwszDescription: super::super::Foundation::PWSTR, pub pwszURL: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for WM_USER_WEB_URL {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for WM_USER_WEB_URL { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct WM_WRITER_STATISTICS { pub qwSampleCount: u64, pub qwByteCount: u64, pub qwDroppedSampleCount: u64, pub qwDroppedByteCount: u64, pub dwCurrentBitrate: u32, pub dwAverageBitrate: u32, pub dwExpectedBitrate: u32, pub dwCurrentSampleRate: u32, pub dwAverageSampleRate: u32, pub dwExpectedSampleRate: u32, } impl ::core::marker::Copy for WM_WRITER_STATISTICS {} impl ::core::clone::Clone for WM_WRITER_STATISTICS { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct WM_WRITER_STATISTICS_EX { pub dwBitratePlusOverhead: u32, pub dwCurrentSampleDropRateInQueue: u32, pub dwCurrentSampleDropRateInCodec: u32, pub dwCurrentSampleDropRateInMultiplexer: u32, pub dwTotalSampleDropsInQueue: u32, pub dwTotalSampleDropsInCodec: u32, pub dwTotalSampleDropsInMultiplexer: u32, } impl ::core::marker::Copy for WM_WRITER_STATISTICS_EX {} impl ::core::clone::Clone for WM_WRITER_STATISTICS_EX { fn clone(&self) -> Self { *self } } pub type _AM_ASFWRITERCONFIG_PARAM = i32; pub const AM_CONFIGASFWRITER_PARAM_AUTOINDEX: _AM_ASFWRITERCONFIG_PARAM = 1i32; pub const AM_CONFIGASFWRITER_PARAM_MULTIPASS: _AM_ASFWRITERCONFIG_PARAM = 2i32; pub const AM_CONFIGASFWRITER_PARAM_DONTCOMPRESS: _AM_ASFWRITERCONFIG_PARAM = 3i32; pub const g_dwWMContentAttributes: u32 = 5u32; pub const g_dwWMNSCAttributes: u32 = 5u32; pub const g_dwWMSpecialAttributes: u32 = 20u32; pub const g_wszASFLeakyBucketPairs: &'static str = "ASFLeakyBucketPairs"; pub const g_wszAllowInterlacedOutput: &'static str = "AllowInterlacedOutput"; pub const g_wszAverageLevel: &'static str = "AverageLevel"; pub const g_wszBufferAverage: &'static str = "Buffer Average"; pub const g_wszComplexity: &'static str = "_COMPLEXITYEX"; pub const g_wszComplexityLive: &'static str = "_COMPLEXITYEXLIVE"; pub const g_wszComplexityMax: &'static str = "_COMPLEXITYEXMAX"; pub const g_wszComplexityOffline: &'static str = "_COMPLEXITYEXOFFLINE"; pub const g_wszDecoderComplexityRequested: &'static str = "_DECODERCOMPLEXITYPROFILE"; pub const g_wszDedicatedDeliveryThread: &'static str = "DedicatedDeliveryThread"; pub const g_wszDeinterlaceMode: &'static str = "DeinterlaceMode"; pub const g_wszDeliverOnReceive: &'static str = "DeliverOnReceive"; pub const g_wszDeviceConformanceTemplate: &'static str = "DeviceConformanceTemplate"; pub const g_wszDynamicRangeControl: &'static str = "DynamicRangeControl"; pub const g_wszEDL: &'static str = "_EDL"; pub const g_wszEarlyDataDelivery: &'static str = "EarlyDataDelivery"; pub const g_wszEnableDiscreteOutput: &'static str = "EnableDiscreteOutput"; pub const g_wszEnableFrameInterpolation: &'static str = "EnableFrameInterpolation"; pub const g_wszEnableWMAProSPDIFOutput: &'static str = "EnableWMAProSPDIFOutput"; pub const g_wszFailSeekOnError: &'static str = "FailSeekOnError"; pub const g_wszFixedFrameRate: &'static str = "FixedFrameRate"; pub const g_wszFold6To2Channels3: &'static str = "Fold6To2Channels3"; pub const g_wszFoldToChannelsTemplate: &'static str = "Fold%luTo%luChannels%lu"; pub const g_wszInitialPatternForInverseTelecine: &'static str = "InitialPatternForInverseTelecine"; pub const g_wszInterlacedCoding: &'static str = "InterlacedCoding"; pub const g_wszIsVBRSupported: &'static str = "_ISVBRSUPPORTED"; pub const g_wszJPEGCompressionQuality: &'static str = "JPEGCompressionQuality"; pub const g_wszJustInTimeDecode: &'static str = "JustInTimeDecode"; pub const g_wszMixedClassMode: &'static str = "MixedClassMode"; pub const g_wszMusicClassMode: &'static str = "MusicClassMode"; pub const g_wszMusicSpeechClassMode: &'static str = "MusicSpeechClassMode"; pub const g_wszNeedsPreviousSample: &'static str = "NeedsPreviousSample"; pub const g_wszNumPasses: &'static str = "_PASSESUSED"; pub const g_wszOriginalSourceFormatTag: &'static str = "_SOURCEFORMATTAG"; pub const g_wszOriginalWaveFormat: &'static str = "_ORIGINALWAVEFORMAT"; pub const g_wszPeakValue: &'static str = "PeakValue"; pub const g_wszPermitSeeksBeyondEndOfStream: &'static str = "PermitSeeksBeyondEndOfStream"; pub const g_wszReloadIndexOnSeek: &'static str = "ReloadIndexOnSeek"; pub const g_wszScrambledAudio: &'static str = "ScrambledAudio"; pub const g_wszSingleOutputBuffer: &'static str = "SingleOutputBuffer"; pub const g_wszSoftwareScaling: &'static str = "SoftwareScaling"; pub const g_wszSourceBufferTime: &'static str = "SourceBufferTime"; pub const g_wszSourceMaxBytesAtOnce: &'static str = "SourceMaxBytesAtOnce"; pub const g_wszSpeakerConfig: &'static str = "SpeakerConfig"; pub const g_wszSpeechCaps: &'static str = "SpeechFormatCap"; pub const g_wszSpeechClassMode: &'static str = "SpeechClassMode"; pub const g_wszStreamLanguage: &'static str = "StreamLanguage"; pub const g_wszStreamNumIndexObjects: &'static str = "StreamNumIndexObjects"; pub const g_wszUsePacketAtSeekPoint: &'static str = "UsePacketAtSeekPoint"; pub const g_wszVBRBitrateMax: &'static str = "_RMAX"; pub const g_wszVBRBufferWindowMax: &'static str = "_BMAX"; pub const g_wszVBREnabled: &'static str = "_VBRENABLED"; pub const g_wszVBRPeak: &'static str = "VBR Peak"; pub const g_wszVBRQuality: &'static str = "_VBRQUALITY"; pub const g_wszVideoSampleDurations: &'static str = "VideoSampleDurations"; pub const g_wszWMADID: &'static str = "WM/ADID"; pub const g_wszWMASFPacketCount: &'static str = "WM/ASFPacketCount"; pub const g_wszWMASFSecurityObjectsSize: &'static str = "WM/ASFSecurityObjectsSize"; pub const g_wszWMAlbumArtist: &'static str = "WM/AlbumArtist"; pub const g_wszWMAlbumArtistSort: &'static str = "WM/AlbumArtistSort"; pub const g_wszWMAlbumCoverURL: &'static str = "WM/AlbumCoverURL"; pub const g_wszWMAlbumTitle: &'static str = "WM/AlbumTitle"; pub const g_wszWMAlbumTitleSort: &'static str = "WM/AlbumTitleSort"; pub const g_wszWMAspectRatioX: &'static str = "AspectRatioX"; pub const g_wszWMAspectRatioY: &'static str = "AspectRatioY"; pub const g_wszWMAudioFileURL: &'static str = "WM/AudioFileURL"; pub const g_wszWMAudioSourceURL: &'static str = "WM/AudioSourceURL"; pub const g_wszWMAuthor: &'static str = "Author"; pub const g_wszWMAuthorSort: &'static str = "AuthorSort"; pub const g_wszWMAuthorURL: &'static str = "WM/AuthorURL"; pub const g_wszWMBannerImageData: &'static str = "BannerImageData"; pub const g_wszWMBannerImageType: &'static str = "BannerImageType"; pub const g_wszWMBannerImageURL: &'static str = "BannerImageURL"; pub const g_wszWMBeatsPerMinute: &'static str = "WM/BeatsPerMinute"; pub const g_wszWMBitrate: &'static str = "Bitrate"; pub const g_wszWMBroadcast: &'static str = "Broadcast"; pub const g_wszWMCategory: &'static str = "WM/Category"; pub const g_wszWMCodec: &'static str = "WM/Codec"; pub const g_wszWMComposer: &'static str = "WM/Composer"; pub const g_wszWMComposerSort: &'static str = "WM/ComposerSort"; pub const g_wszWMConductor: &'static str = "WM/Conductor"; pub const g_wszWMContainerFormat: &'static str = "WM/ContainerFormat"; pub const g_wszWMContentDistributor: &'static str = "WM/ContentDistributor"; pub const g_wszWMContentGroupDescription: &'static str = "WM/ContentGroupDescription"; pub const g_wszWMCopyright: &'static str = "Copyright"; pub const g_wszWMCopyrightURL: &'static str = "CopyrightURL"; pub const g_wszWMCurrentBitrate: &'static str = "CurrentBitrate"; pub const g_wszWMDRM: &'static str = "WM/DRM"; pub const g_wszWMDRM_ContentID: &'static str = "DRM_ContentID"; pub const g_wszWMDRM_Flags: &'static str = "DRM_Flags"; pub const g_wszWMDRM_HeaderSignPrivKey: &'static str = "DRM_HeaderSignPrivKey"; pub const g_wszWMDRM_IndividualizedVersion: &'static str = "DRM_IndividualizedVersion"; pub const g_wszWMDRM_KeyID: &'static str = "DRM_KeyID"; pub const g_wszWMDRM_KeySeed: &'static str = "DRM_KeySeed"; pub const g_wszWMDRM_LASignatureCert: &'static str = "DRM_LASignatureCert"; pub const g_wszWMDRM_LASignatureLicSrvCert: &'static str = "DRM_LASignatureLicSrvCert"; pub const g_wszWMDRM_LASignaturePrivKey: &'static str = "DRM_LASignaturePrivKey"; pub const g_wszWMDRM_LASignatureRootCert: &'static str = "DRM_LASignatureRootCert"; pub const g_wszWMDRM_Level: &'static str = "DRM_Level"; pub const g_wszWMDRM_LicenseAcqURL: &'static str = "DRM_LicenseAcqURL"; pub const g_wszWMDRM_SourceID: &'static str = "DRM_SourceID"; pub const g_wszWMDRM_V1LicenseAcqURL: &'static str = "DRM_V1LicenseAcqURL"; pub const g_wszWMDVDID: &'static str = "WM/DVDID"; pub const g_wszWMDescription: &'static str = "Description"; pub const g_wszWMDirector: &'static str = "WM/Director"; pub const g_wszWMDuration: &'static str = "Duration"; pub const g_wszWMEncodedBy: &'static str = "WM/EncodedBy"; pub const g_wszWMEncodingSettings: &'static str = "WM/EncodingSettings"; pub const g_wszWMEncodingTime: &'static str = "WM/EncodingTime"; pub const g_wszWMEpisodeNumber: &'static str = "WM/EpisodeNumber"; pub const g_wszWMFileSize: &'static str = "FileSize"; pub const g_wszWMGenre: &'static str = "WM/Genre"; pub const g_wszWMGenreID: &'static str = "WM/GenreID"; pub const g_wszWMHasArbitraryDataStream: &'static str = "HasArbitraryDataStream"; pub const g_wszWMHasAttachedImages: &'static str = "HasAttachedImages"; pub const g_wszWMHasAudio: &'static str = "HasAudio"; pub const g_wszWMHasFileTransferStream: &'static str = "HasFileTransferStream"; pub const g_wszWMHasImage: &'static str = "HasImage"; pub const g_wszWMHasScript: &'static str = "HasScript"; pub const g_wszWMHasVideo: &'static str = "HasVideo"; pub const g_wszWMISAN: &'static str = "WM/ISAN"; pub const g_wszWMISRC: &'static str = "WM/ISRC"; pub const g_wszWMInitialKey: &'static str = "WM/InitialKey"; pub const g_wszWMIsCompilation: &'static str = "WM/IsCompilation"; pub const g_wszWMIsVBR: &'static str = "IsVBR"; pub const g_wszWMLanguage: &'static str = "WM/Language"; pub const g_wszWMLyrics: &'static str = "WM/Lyrics"; pub const g_wszWMLyrics_Synchronised: &'static str = "WM/Lyrics_Synchronised"; pub const g_wszWMMCDI: &'static str = "WM/MCDI"; pub const g_wszWMMediaClassPrimaryID: &'static str = "WM/MediaClassPrimaryID"; pub const g_wszWMMediaClassSecondaryID: &'static str = "WM/MediaClassSecondaryID"; pub const g_wszWMMediaCredits: &'static str = "WM/MediaCredits"; pub const g_wszWMMediaIsDelay: &'static str = "WM/MediaIsDelay"; pub const g_wszWMMediaIsFinale: &'static str = "WM/MediaIsFinale"; pub const g_wszWMMediaIsLive: &'static str = "WM/MediaIsLive"; pub const g_wszWMMediaIsPremiere: &'static str = "WM/MediaIsPremiere"; pub const g_wszWMMediaIsRepeat: &'static str = "WM/MediaIsRepeat"; pub const g_wszWMMediaIsSAP: &'static str = "WM/MediaIsSAP"; pub const g_wszWMMediaIsStereo: &'static str = "WM/MediaIsStereo"; pub const g_wszWMMediaIsSubtitled: &'static str = "WM/MediaIsSubtitled"; pub const g_wszWMMediaIsTape: &'static str = "WM/MediaIsTape"; pub const g_wszWMMediaNetworkAffiliation: &'static str = "WM/MediaNetworkAffiliation"; pub const g_wszWMMediaOriginalBroadcastDateTime: &'static str = "WM/MediaOriginalBroadcastDateTime"; pub const g_wszWMMediaOriginalChannel: &'static str = "WM/MediaOriginalChannel"; pub const g_wszWMMediaStationCallSign: &'static str = "WM/MediaStationCallSign"; pub const g_wszWMMediaStationName: &'static str = "WM/MediaStationName"; pub const g_wszWMModifiedBy: &'static str = "WM/ModifiedBy"; pub const g_wszWMMood: &'static str = "WM/Mood"; pub const g_wszWMNSCAddress: &'static str = "NSC_Address"; pub const g_wszWMNSCDescription: &'static str = "NSC_Description"; pub const g_wszWMNSCEmail: &'static str = "NSC_Email"; pub const g_wszWMNSCName: &'static str = "NSC_Name"; pub const g_wszWMNSCPhone: &'static str = "NSC_Phone"; pub const g_wszWMNumberOfFrames: &'static str = "NumberOfFrames"; pub const g_wszWMOptimalBitrate: &'static str = "OptimalBitrate"; pub const g_wszWMOriginalAlbumTitle: &'static str = "WM/OriginalAlbumTitle"; pub const g_wszWMOriginalArtist: &'static str = "WM/OriginalArtist"; pub const g_wszWMOriginalFilename: &'static str = "WM/OriginalFilename"; pub const g_wszWMOriginalLyricist: &'static str = "WM/OriginalLyricist"; pub const g_wszWMOriginalReleaseTime: &'static str = "WM/OriginalReleaseTime"; pub const g_wszWMOriginalReleaseYear: &'static str = "WM/OriginalReleaseYear"; pub const g_wszWMParentalRating: &'static str = "WM/ParentalRating"; pub const g_wszWMParentalRatingReason: &'static str = "WM/ParentalRatingReason"; pub const g_wszWMPartOfSet: &'static str = "WM/PartOfSet"; pub const g_wszWMPeakBitrate: &'static str = "WM/PeakBitrate"; pub const g_wszWMPeriod: &'static str = "WM/Period"; pub const g_wszWMPicture: &'static str = "WM/Picture"; pub const g_wszWMPlaylistDelay: &'static str = "WM/PlaylistDelay"; pub const g_wszWMProducer: &'static str = "WM/Producer"; pub const g_wszWMPromotionURL: &'static str = "WM/PromotionURL"; pub const g_wszWMProtected: &'static str = "Is_Protected"; pub const g_wszWMProtectionType: &'static str = "WM/ProtectionType"; pub const g_wszWMProvider: &'static str = "WM/Provider"; pub const g_wszWMProviderCopyright: &'static str = "WM/ProviderCopyright"; pub const g_wszWMProviderRating: &'static str = "WM/ProviderRating"; pub const g_wszWMProviderStyle: &'static str = "WM/ProviderStyle"; pub const g_wszWMPublisher: &'static str = "WM/Publisher"; pub const g_wszWMRadioStationName: &'static str = "WM/RadioStationName"; pub const g_wszWMRadioStationOwner: &'static str = "WM/RadioStationOwner"; pub const g_wszWMRating: &'static str = "Rating"; pub const g_wszWMSeasonNumber: &'static str = "WM/SeasonNumber"; pub const g_wszWMSeekable: &'static str = "Seekable"; pub const g_wszWMSharedUserRating: &'static str = "WM/SharedUserRating"; pub const g_wszWMSignature_Name: &'static str = "Signature_Name"; pub const g_wszWMSkipBackward: &'static str = "Can_Skip_Backward"; pub const g_wszWMSkipForward: &'static str = "Can_Skip_Forward"; pub const g_wszWMStreamTypeInfo: &'static str = "WM/StreamTypeInfo"; pub const g_wszWMStridable: &'static str = "Stridable"; pub const g_wszWMSubTitle: &'static str = "WM/SubTitle"; pub const g_wszWMSubTitleDescription: &'static str = "WM/SubTitleDescription"; pub const g_wszWMSubscriptionContentID: &'static str = "WM/SubscriptionContentID"; pub const g_wszWMText: &'static str = "WM/Text"; pub const g_wszWMTitle: &'static str = "Title"; pub const g_wszWMTitleSort: &'static str = "TitleSort"; pub const g_wszWMToolName: &'static str = "WM/ToolName"; pub const g_wszWMToolVersion: &'static str = "WM/ToolVersion"; pub const g_wszWMTrack: &'static str = "WM/Track"; pub const g_wszWMTrackNumber: &'static str = "WM/TrackNumber"; pub const g_wszWMTrusted: &'static str = "Is_Trusted"; pub const g_wszWMUniqueFileIdentifier: &'static str = "WM/UniqueFileIdentifier"; pub const g_wszWMUse_Advanced_DRM: &'static str = "Use_Advanced_DRM"; pub const g_wszWMUse_DRM: &'static str = "Use_DRM"; pub const g_wszWMUserWebURL: &'static str = "WM/UserWebURL"; pub const g_wszWMVideoClosedCaptioning: &'static str = "WM/VideoClosedCaptioning"; pub const g_wszWMVideoFrameRate: &'static str = "WM/VideoFrameRate"; pub const g_wszWMVideoHeight: &'static str = "WM/VideoHeight"; pub const g_wszWMVideoWidth: &'static str = "WM/VideoWidth"; pub const g_wszWMWMADRCAverageReference: &'static str = "WM/WMADRCAverageReference"; pub const g_wszWMWMADRCAverageTarget: &'static str = "WM/WMADRCAverageTarget"; pub const g_wszWMWMADRCPeakReference: &'static str = "WM/WMADRCPeakReference"; pub const g_wszWMWMADRCPeakTarget: &'static str = "WM/WMADRCPeakTarget"; pub const g_wszWMWMCPDistributor: &'static str = "WM/WMCPDistributor"; pub const g_wszWMWMCPDistributorID: &'static str = "WM/WMCPDistributorID"; pub const g_wszWMWMCollectionGroupID: &'static str = "WM/WMCollectionGroupID"; pub const g_wszWMWMCollectionID: &'static str = "WM/WMCollectionID"; pub const g_wszWMWMContentID: &'static str = "WM/WMContentID"; pub const g_wszWMWMShadowFileSourceDRMType: &'static str = "WM/WMShadowFileSourceDRMType"; pub const g_wszWMWMShadowFileSourceFileType: &'static str = "WM/WMShadowFileSourceFileType"; pub const g_wszWMWriter: &'static str = "WM/Writer"; pub const g_wszWMYear: &'static str = "WM/Year"; pub const g_wszWatermarkCLSID: &'static str = "WatermarkCLSID"; pub const g_wszWatermarkConfig: &'static str = "WatermarkConfig";
use mozjpeg; use std::path::{ Path, PathBuf }; use std::{str, fs}; use sciter::Value; use crate::misc::{ Args, Options, make_error_message, append_dir }; pub fn compress_file(file_name: String, options: Options) -> Args { println!("jpg::compress_file"); let path = Path::new(&file_name); if !path.is_file() { return make_error_message(format!("Not a file: {}", path.display())); } let add_ext = match options.addExt.to_bool().unwrap() { true => ".min", _ => "" }; let add_folder = options.addFolder.to_bool().unwrap(); if add_folder { let path = path.clone().parent().unwrap().join("minified"); fs::create_dir_all(path); } let out_file_name_string = format!( "{}{}.{}", path.file_stem().unwrap().to_str().unwrap(), add_ext, path.extension().unwrap().to_str().unwrap() ); let mut out_file_name_path_buf = path.with_file_name(out_file_name_string); if add_folder { out_file_name_path_buf = append_dir(Path::new(&out_file_name_path_buf), "minified"); } let data = std::fs::read(path).unwrap(); let sizeBefore = data.len() as i32; println!("{:?}", data.len()); let dinfo = mozjpeg::Decompress::new_mem(&data[..]).unwrap(); println!("{:?}", dinfo.size()); let mut dinfo = dinfo.raw().unwrap(); let width = dinfo.width(); let height = dinfo.height(); let mut bitmaps = [&mut Vec::new(), &mut Vec::new(), &mut Vec::new()]; dinfo.read_raw_data(&mut bitmaps); println!("{:?} {:?} {:?}", bitmaps[0].len(), bitmaps[1].len(), bitmaps[2].len()); println!("{:?}", dinfo.finish_decompress()); let mut cinfo = mozjpeg::Compress::new(mozjpeg::ColorSpace::JCS_YCbCr); cinfo.set_size(width, height); #[allow(deprecated)] { cinfo.set_gamma(1.0); } cinfo.set_progressive_mode(); cinfo.set_scan_optimization_mode(mozjpeg::ScanMode::Auto); cinfo.set_raw_data_in(true); cinfo.set_quality(88.); cinfo.set_mem_dest(); for (c, samp) in cinfo.components_mut().iter_mut().zip(vec![2, 1, 1]) { c.v_samp_factor = samp; c.h_samp_factor = samp; } cinfo.start_compress(); //cinfo.write_marker(Marker::APP(2), "Hello World".as_bytes()); cinfo.write_raw_data(&bitmaps.iter().map(|c| &c[..]).collect::<Vec<_>>()); cinfo.finish_compress(); let output = cinfo.data_to_vec().unwrap(); println!("{:?}", output.len()); let sizeAfter = output.len() as i32; match std::fs::write(&out_file_name_path_buf, output) { Ok(_) => Args { path: Value::from(out_file_name_path_buf.display().to_string()), sizeBefore: Value::from(sizeBefore), sizeAfter: Value::from(sizeAfter), error: Value::from(false) }, Err(_) => make_error_message(format!("Failed to write the file: {}", out_file_name_path_buf.display())) } }
use std::iter::Map; use std::io::{self, BufRead, Lines, Result}; use std::cmp; /* day 1 */ fn fuel_for(mass: u32) -> u32 { cmp::max(mass / 3, 2) - 2 } /* day 2 */ fn fuel_for_rec(mass: u32) -> u32 { let fuel = fuel_for(mass); if fuel > 0 { fuel + fuel_for_rec(fuel) } else { fuel } } fn main() { let stdin = io::stdin(); let handle = stdin.lock(); let l: Lines<_> = handle.lines(); let lines: Map<_, _> = l.map(|l: Result<String>| l.unwrap()); let ints: _ = lines.map(|l| l.parse().unwrap()); let fuel: u32 = ints.map(fuel_for_rec).sum(); println!("{}", fuel); }
#![allow(dead_code)] use std::{cmp, io}; use atoi::FromRadix10; use ntex::util::{BufMut, BytesMut}; pub const SIZE: usize = 27; pub fn get_query_param(query: Option<&str>) -> u16 { let query = query.unwrap_or(""); let q = if let Some(pos) = query.find('q') { u16::from_radix_10(query.split_at(pos + 2).1.as_ref()).0 } else { 1 }; cmp::min(500, cmp::max(1, q)) } pub struct Writer<'a>(pub &'a mut BytesMut); impl<'a> io::Write for Writer<'a> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { self.0.put_slice(buf); Ok(buf.len()) } fn flush(&mut self) -> io::Result<()> { Ok(()) } }
use std::collections::HashSet; use crate::{prelude::*, map::{Map, MapClass}}; /// Subsequently chains two mappins together. pub struct Chain<F: Map, S: Map> { pub first: F, pub second: S, } impl<F: Map, S: Map> Chain<F, S> { pub fn new(first: F, second: S) -> Self { Self { first, second } } } impl<F: Map, S: Map> Map for Chain<F, S> {} impl<F: Map, S: Map> Instance<MapClass> for Chain<F, S> { fn source(cache: &mut HashSet<u64>) -> String { if !cache.insert(Self::type_hash()) { return String::new() } [ F::source(cache), S::source(cache), "#include <clay_core/map/chain.h>".to_string(), format!( "MAP_CHAIN({}, {}, {}, {}, {})", Self::inst_name(), F::inst_name(), S::inst_name(), F::size_int(), F::size_float(), ), ].join("\n") } fn inst_name() -> String { format!( "__{}_{}_{:x}", F::inst_name(), S::inst_name(), Self::type_hash(), ) } } impl<F: Map, S: Map> Pack for Chain<F, S> { fn size_int() -> usize { F::size_int() + S::size_int() } fn size_float() -> usize { F::size_float() + S::size_float() } fn pack_to(&self, buffer_int: &mut [i32], buffer_float: &mut [f32]) { Packer::new(buffer_int, buffer_float) .pack(&self.first) .pack(&self.second); } }
#[doc = "Reader of register CTL"] pub type R = crate::R<u32, super::CTL>; #[doc = "Writer for register CTL"] pub type W = crate::W<u32, super::CTL>; #[doc = "Register CTL `reset()`'s with value 0"] impl crate::ResetValue for super::CTL { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `GLOBALSYNC0`"] pub type GLOBALSYNC0_R = crate::R<bool, bool>; #[doc = "Write proxy for field `GLOBALSYNC0`"] pub struct GLOBALSYNC0_W<'a> { w: &'a mut W, } impl<'a> GLOBALSYNC0_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01); self.w } } #[doc = "Reader of field `GLOBALSYNC1`"] pub type GLOBALSYNC1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `GLOBALSYNC1`"] pub struct GLOBALSYNC1_W<'a> { w: &'a mut W, } impl<'a> GLOBALSYNC1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1); self.w } } #[doc = "Reader of field `GLOBALSYNC2`"] pub type GLOBALSYNC2_R = crate::R<bool, bool>; #[doc = "Write proxy for field `GLOBALSYNC2`"] pub struct GLOBALSYNC2_W<'a> { w: &'a mut W, } impl<'a> GLOBALSYNC2_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2); self.w } } #[doc = "Reader of field `GLOBALSYNC3`"] pub type GLOBALSYNC3_R = crate::R<bool, bool>; #[doc = "Write proxy for field `GLOBALSYNC3`"] pub struct GLOBALSYNC3_W<'a> { w: &'a mut W, } impl<'a> GLOBALSYNC3_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3); self.w } } impl R { #[doc = "Bit 0 - Update PWM Generator 0"] #[inline(always)] pub fn globalsync0(&self) -> GLOBALSYNC0_R { GLOBALSYNC0_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Update PWM Generator 1"] #[inline(always)] pub fn globalsync1(&self) -> GLOBALSYNC1_R { GLOBALSYNC1_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - Update PWM Generator 2"] #[inline(always)] pub fn globalsync2(&self) -> GLOBALSYNC2_R { GLOBALSYNC2_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - Update PWM Generator 3"] #[inline(always)] pub fn globalsync3(&self) -> GLOBALSYNC3_R { GLOBALSYNC3_R::new(((self.bits >> 3) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - Update PWM Generator 0"] #[inline(always)] pub fn globalsync0(&mut self) -> GLOBALSYNC0_W { GLOBALSYNC0_W { w: self } } #[doc = "Bit 1 - Update PWM Generator 1"] #[inline(always)] pub fn globalsync1(&mut self) -> GLOBALSYNC1_W { GLOBALSYNC1_W { w: self } } #[doc = "Bit 2 - Update PWM Generator 2"] #[inline(always)] pub fn globalsync2(&mut self) -> GLOBALSYNC2_W { GLOBALSYNC2_W { w: self } } #[doc = "Bit 3 - Update PWM Generator 3"] #[inline(always)] pub fn globalsync3(&mut self) -> GLOBALSYNC3_W { GLOBALSYNC3_W { w: self } } }
use crate::geometry::vector::dot; use crate::math::next_float_down; use crate::math::next_float_up; use crate::medium::Medium; use crate::types::Float; use crate::Normal3f; use crate::Point3f; use crate::Vector3f; use num::abs; use num::Signed; #[derive(Clone)] pub struct Ray { pub origin: Point3f, pub direction: Vector3f, pub time: Float, pub time_max: Float, pub origin_error: Option<Vector3f>, pub direction_error: Option<Vector3f>, // pub medium: Option<&'a Medium>, pub has_differentials: bool, pub rx_origin: Option<Point3f>, pub ry_origin: Option<Point3f>, pub rx_direction: Option<Vector3f>, pub ry_direction: Option<Vector3f>, } impl Ray { pub fn new( origin: Point3f, direction: Vector3f, time: Float, time_max: Float, // medium: Option<&'a Medium>, ) -> Ray { Ray { origin, direction, time, time_max, origin_error: None, direction_error: None, // medium, has_differentials: false, rx_origin: None, ry_origin: None, rx_direction: None, ry_direction: None, } } pub fn point_at(&self, t: Float) -> Point3f { self.origin + self.direction * t } } pub fn offset_ray_origin(p: &Point3f, p_error: &Vector3f, n: &Normal3f, w: &Vector3f) -> Point3f { let d = dot(&n.abs(), &p_error); let mut offset = *n * d; if dot(w, n) < 0.0 { offset = -offset; } let mut po = *p + offset; for i in 0..3 { if offset[i] > 0.0 { po[i] = next_float_up(po[i]); } else if offset[i] < 0.0 { po[i] = next_float_down(po[i]); } } po }
use rand; //extern crate openssl; use std::prelude::v1::*; use sha1::Sha1; //#[test] pub fn test_simple() { let mut m = Sha1::new(); let tests = [ ("The quick brown fox jumps over the lazy dog", "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"), ("The quick brown fox jumps over the lazy cog", "de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3"), ("", "da39a3ee5e6b4b0d3255bfef95601890afd80709"), ("testing\n", "9801739daae44ec5293d4e1f53d3f4d2d426d91c"), ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "025ecbd5d70f8fb3c5457cd96bab13fda305dc59"), ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "4300320394f7ee239bcdce7d3b8bcee173a0cd5c"), ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "cef734ba81a024479e09eb5a75b6ddae62e6abf1"), ]; for &(s, ref h) in tests.iter() { let data = s.as_bytes(); m.reset(); m.update(data); let hh = m.digest().to_string(); assert_eq!(hh.len(), h.len()); assert_eq!(hh, *h); } } //#[test] pub fn test_shortcuts() { let s = Sha1::from("The quick brown fox jumps over the lazy dog"); assert_eq!(s.digest().to_string(), "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"); let s = Sha1::from(&b"The quick brown fox jumps over the lazy dog"[..]); assert_eq!(s.digest().to_string(), "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"); #[cfg(feature="std")] { let s = Sha1::from("The quick brown fox jumps over the lazy dog"); assert_eq!(s.hexdigest(), "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"); } } //#[test] pub fn test_multiple_updates() { let mut m = Sha1::new(); m.reset(); m.update("The quick brown ".as_bytes()); m.update("fox jumps over ".as_bytes()); m.update("the lazy dog".as_bytes()); let hh = m.digest().to_string(); let h = "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"; assert_eq!(hh.len(), h.len()); assert_eq!(hh, &*h); } //#[test] pub fn test_sha1_loop() { let mut m = Sha1::new(); let s = "The quick brown fox jumps over the lazy dog."; let n = 1000u64; for _ in 0..3 { m.reset(); for _ in 0..n { m.update(s.as_bytes()); } assert_eq!(m.digest().to_string(), "7ca27655f67fceaa78ed2e645a81c7f1d6e249d2"); } } //#[test] pub fn spray_and_pray() { use rand::Rng; use rand::RngCore; use sgx_tcrypto::SgxSha1Handle; let mut rng = rand::thread_rng(); let mut m = Sha1::new(); let mut bytes = [0; 512]; for _i in 0..20 { // let ty = openssl::hash::MessageDigest::sha1(); // let mut r = openssl::hash::Hasher::new(ty).unwrap(); let sgx_sha1 = SgxSha1Handle::new(); sgx_sha1.init().unwrap(); m.reset(); for _ in 0..50 { let len = rng.gen::<usize>() % (bytes.len() - 1) + 1; rng.fill_bytes(&mut bytes[..len]); m.update(&bytes[..len]); sgx_sha1.update_slice(&bytes[..len]).unwrap(); // r.update(&bytes[..len]).unwrap(); } // assert_eq!(r.finish().unwrap().as_ref(), &m.digest().bytes()); assert_eq!(sgx_sha1.get_hash().unwrap().as_ref(), &m.digest().bytes()); } } //#[test] //#[cfg(feature="std")] #[allow(deprecated)] pub fn test_parse() { use sha1::Digest; use std::error::Error; let y: Digest = "2ef7bde608ce5404e97d5f042f95f89f1c232871".parse().unwrap(); assert_eq!(y.to_string(), "2ef7bde608ce5404e97d5f042f95f89f1c232871"); assert!("asdfasdf".parse::<Digest>().is_err()); assert_eq!("asdfasdf".parse::<Digest>() .map_err(|x| x.description().to_string()).unwrap_err(), "not a valid sha1 hash"); } pub mod serde_tests { use serde_json; use std::prelude::v1::*; use sha1::{Sha1, Digest}; //#[test] pub fn test_to_json() { let mut s = Sha1::new(); s.update(b"Hello World!"); let x = s.digest(); let y = serde_json::to_vec(&x).unwrap(); assert_eq!(y, &b"\"2ef7bde608ce5404e97d5f042f95f89f1c232871\""[..]); } //#[test] pub fn test_from_json() { let y: Digest = serde_json::from_str("\"2ef7bde608ce5404e97d5f042f95f89f1c232871\"").unwrap(); assert_eq!(y.to_string(), "2ef7bde608ce5404e97d5f042f95f89f1c232871"); } }
// Copyright 2015 Jerome Rasky <jerome@rasky.co> // // Licensed under the Apache License, version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // <http://www.apache.org/licenses/LICENSE-2.0> // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the // License for the specific language concerning governing permissions and // limitations under the License. use std::io::prelude::*; use term::terminfo::TermInfo; use unicode_width::*; use std::sync::mpsc::{Receiver, Sender}; use std::borrow::{Cow, Borrow}; use std::collections::HashMap; use std::iter::FromIterator; use std::sync::mpsc; use std::io; use std::env; use std::thread; use bis_c::{TermTrack, TermSize}; use error::StringError; use search::SearchBase; use constants::*; // TermControl contains utility funcitons for terminfo #[derive(Debug)] struct TermControl { strings: HashMap<String, String> } #[derive(PartialEq, Clone, Debug)] enum TermStack { // here for correctness #[allow(dead_code)] Str(String), Int(isize), // here for correctness #[allow(dead_code)] Bool(bool) } // our user interface instance pub struct UI { // track is a guard, we never touch it manually #[allow(dead_code)] track: TermTrack, size: TermSize, control: TermControl, query: Sender<String>, matches: Receiver<Vec<Cow<'static, str>>>, chars: Receiver<char>, chars_stop: Sender<()>, stop: Receiver<()> } impl TermControl { pub fn create() -> Result<TermControl, StringError> { debug!("Getting terminal info"); let info = match TermInfo::from_env() { Ok(info) => info, Err(e) => return Err(StringError::new("Failed to get TermInfo", Some(Box::new(e)))) }; trace!("Got terminfo: {:?}", info); let mut strings = HashMap::default(); for (name, value) in info.strings.into_iter() { strings.insert(name, match String::from_utf8(value) { Ok(s) => s, Err(e) => return Err(StringError::new("Failed to convert value into an OsString", Some(Box::new(e)))) }); } // right now all we care about are the strings Ok(TermControl { strings: strings }) } pub fn get_string<T: Borrow<String>>(&mut self, name: T, params: Vec<TermStack>) -> Option<String> { // only implement what we're actually using in the UI let sequence = match self.strings.get(name.borrow()) { None => { trace!("No match for string: {:?}", name.borrow()); return None; }, Some(s) => { trace!("Matched string: {:?}", s); s.clone() } }; let mut escaped = false; let mut stack: Vec<TermStack> = vec![]; let mut result = String::default(); let mut escape = String::default(); // only implement the sequences we care about for c in sequence.chars() { if !escaped { if c == '%' { escaped = true; } else { result.push(c); } } else if escape.is_empty() { if c == 'd' { match stack.pop() { Some(TermStack::Int(c)) => { result.push_str(format!("{}", c).as_ref()); }, Some(o) => { error!("Numeric print on non-numeric type: {:?}", o); }, None => { error!("Stack was empty on print"); } } escaped = false; } else if c == 'p' { escape.push('p'); } else { error!("Unknown escape character: {:?}", c); escaped = false; } } else { if escape == "p" { match c.to_digit(10) { Some(idx) => { if idx != 0 { match params.get(idx as usize - 1) { Some(item) => { stack.push(item.clone()) }, None => { error!("There was no parameter {}", idx); } } } else { error!("Tried to print 0th paramater"); } }, None => { error!("Paramater number was not a digit"); } } escape.clear(); escaped = false; } else { error!("Unknown escape sequence: {:?}", escape); escape.clear(); escaped = false; } } } trace!("Returning result: {:?}", result); // return result Some(result) } } impl UI { pub fn create() -> Result<UI, StringError> { debug!("Creating TermControl"); let control = try!(TermControl::create()); trace!("Got TermControl: {:?}", control); let mut track = TermTrack::default(); debug!("Getting terminal size"); let size = match track.get_size() { Err(e) => return Err(StringError::new("Failed to get terminal size", Some(Box::new(e)))), Ok(s) => { trace!("Terminal size: {:?}", s); s } }; debug!("Preparing terminal"); match track.prepare() { Err(e) => return Err(StringError::new("Failed to prepare terminal", Some(Box::new(e)))), Ok(_) => { trace!("Terminal prepared successfully"); } } debug!("Masking sigint on main thread"); match ::bis_c::mask_sigint() { Ok(_) => { trace!("Set signal mask successfully"); }, Err(e) => return Err(StringError::new("Failed to mask signal", Some(Box::new(e)))) } debug!("Starting search thread"); trace!("Creating thread primitives"); let (query_tx, query_rx) = mpsc::channel(); let (matches_tx, matches_rx) = mpsc::channel(); trace!("Starting thread"); thread::spawn(move || { search_thread(query_rx, matches_tx); }); debug!("Starting input thread"); trace!("Creating thread primitives"); let (chars_tx, chars_rx) = mpsc::channel(); let (chars_stop_tx, chars_stop_rx) = mpsc::channel(); trace!("Starting thread"); thread::spawn(move || { input_thread(chars_tx, chars_stop_rx); }); debug!("Starting signal thread"); trace!("Creating thread primitives"); let (stop_tx, stop_rx) = mpsc::channel(); trace!("Starting thread"); thread::spawn(move || { signal_thread(stop_tx); }); debug!("Creating UI instance"); let instance = UI { track: track, size: size, control: control, query: query_tx, matches: matches_rx, chars: chars_rx, chars_stop: chars_stop_tx, stop: stop_rx }; trace!("Instance creation successful"); Ok(instance) } fn insert_match(&self, best_match: String) -> Result<(), StringError> { // send the stop signal to the input thread match self.chars_stop.send(()) { Ok(_) => { trace!("Successfully sent stop to input thread"); }, Err(e) => { return Err(StringError::new("Failed to send stop signal to input thread", Some(Box::new(e)))); } } // simulate a space input to wake up the input thread match ::bis_c::insert_input(" ") { Ok(_) => { trace!("Successfully simulated input"); }, Err(e) => { return Err(StringError::new("Failed to simulate input to console", Some(Box::new(e)))) } } // wait for the input thread to exit loop { match self.chars.recv() { Ok(_) => { trace!("Draining input thread"); }, Err(_) => { trace!("Thread has exited"); break; } } } match ::bis_c::insert_input(best_match) { Ok(_) => { trace!("Successfully inserted best match"); Ok(()) }, Err(e) => { Err(StringError::new("Failed to simulate input to console", Some(Box::new(e)))) } } } pub fn start(&mut self) -> Result<(), StringError> { // assume start on a new line // get handles for io let handle = io::stdout(); let mut output = handle.lock(); let mut query = String::new(); // make space for our matches match write!(output, "{}{}", String::from_iter(vec!['\n'; MATCH_NUMBER].into_iter()), self.control.get_string("cuu".to_owned(), vec![TermStack::Int(MATCH_NUMBER as isize)]).unwrap_or(format!(""))) { Err(e) => return Err(StringError::new("Failed to create space", Some(Box::new(e)))), Ok(_) => { trace!("Successfully created space on terminal"); } } // draw our prompt and save the cursor debug!("Drawing prompt"); match write!(output, "{}{}", PROMPT, self.control.get_string("sc".to_owned(), vec![]).unwrap_or(format!(""))) { Err(e) => return Err(StringError::new("Failed to draw prompt", Some(Box::new(e)))), Ok(_) => { trace!("Drew prompt successfully"); } } // flush the output debug!("Flushing output"); match output.flush() { Ok(_) => { trace!("Successfully flushed output"); }, Err(e) => { return Err(StringError::new("Failed to flush output", Some(Box::new(e)))); } } // are you kidding me with this stupid macro bullshit let matches_chan = &self.matches; let chars_chan = &self.chars; let stop_chan = &self.stop; let mut best_match = None; let mut stopped = false; loop { // this macro is bad and the rust people should feel bad // on the other hand, multi-threaded UI! Yay! select! { _ = stop_chan.recv() => { // any event on this channel means stop debug!("Event on stop thread, exiting"); // set the stopped variable stopped = true; // exit break; }, maybe_matches = matches_chan.recv() => { let matches = match maybe_matches { Ok(m) => m, Err(e) => return Err(StringError::new("Query thread hung up", Some(Box::new(e)))) }; debug!("Got matches: {:?}", matches); // update the best match if we have one match matches.first() { Some(m) => { best_match = Some(m.clone()); }, None => { best_match = None; } } // draw the matches for item in matches.into_iter() { if UnicodeWidthStr::width(item.as_ref()) > self.size.cols { let mut owned = item.into_owned(); while UnicodeWidthStr::width(owned.as_str()) > self.size.cols { // truncate long lines owned.pop(); } // draw the truncated item match write!(output, "\n{}", owned) { Err(e) => return Err(StringError::new("Failed to draw match", Some(Box::new(e)))), Ok(_) => { trace!("Drew match successfully"); } } } else { // draw the match after a newline match write!(output, "\n{}", item) { Err(e) => return Err(StringError::new("Failed to draw match", Some(Box::new(e)))), Ok(_) => { trace!("Drew match successfully"); } } } } // restore the cursor match write!(output, "{}", self.control.get_string("rc".to_owned(), vec![]).unwrap_or(format!(""))) { Err(e) => return Err(StringError::new("Failed to restore cursor", Some(Box::new(e)))), Ok(_) => { trace!("Restored cursor successfully"); } } }, maybe_chr = chars_chan.recv() => { let chr = match maybe_chr { Ok(c) => c, Err(e) => { // io hung up, exit debug!("IO thread hung up: {:?}", e); break; } }; debug!("Got character: {:?}", chr); if chr.is_control() { match chr { EOT => { // stop stopped = true; // exit break; }, CTRL_U => { // move query.len() left, clear to end of screen match write!(output, "{}{}", self.control.get_string("cub".to_owned(), vec![TermStack::Int(query.len() as isize)]) .unwrap_or(format!("")), self.control.get_string("clr_eos".to_owned(), vec![]).unwrap_or(format!(""))) { Err(e) => return Err(StringError::new("Failed to create space", Some(Box::new(e)))), Ok(_) => { trace!("Successfully created space on terminal"); } } // clear the query query.clear(); // clear the best match best_match = None; }, '\n' => { // exit break; }, _ => { // unknown character // \u{7} is BEL match write!(output, "\u{7}") { Err(e) => return Err(StringError::new("Failed to output bell character", Some(Box::new(e)))), Ok(_) => { trace!("Successfully outputted bel character"); } } } } } else { if UnicodeWidthStr::width(query.as_str()) + UnicodeWidthStr::width(PROMPT) + UnicodeWidthChar::width(chr).unwrap_or(0) >= self.size.cols { // don't allow users to type past the end of one line // \u{7} is BEL match write!(output, "\u{7}") { Err(e) => return Err(StringError::new("Failed to output bell character", Some(Box::new(e)))), Ok(_) => { trace!("Successfully outputted bel character"); } } } else { // push the character onto the query string query.push(chr); // draw the character, save the cursor position, clear the screen after us match write!(output, "{}{}{}", chr, self.control.get_string("sc".to_owned(), vec![]).unwrap_or(format!("")), self.control.get_string("clr_eos".to_owned(), vec![]).unwrap_or(format!(""))) { Err(e) => return Err(StringError::new("Failed to output character", Some(Box::new(e)))), Ok(_) => { trace!("Outputted character successfully"); } } // send the search thread our query debug!("Sending {} to search thread", &query); match self.query.send(query.clone()) { Ok(_) => { trace!("Send successful"); }, Err(e) => { return Err(StringError::new("Failed to send to search thread", Some(Box::new(e)))); } } } } } } // flush the output match output.flush() { Ok(_) => { trace!("Successfully flushed output"); }, Err(e) => { return Err(StringError::new("Failed to flush output", Some(Box::new(e)))); } } } // draw the best match if we have one match best_match { Some(ref m) => { // redraw the best match match write!(output, " -> {}", m) { Err(e) => return Err(StringError::new("Failed to write best match", Some(Box::new(e)))), Ok(_) => { trace!("Drew best match successfully"); } } }, None => { trace!("Not redrawing best match"); } } // clear the screen and move to a new line match write!(output, "{}\n", self.control.get_string("clr_eos".to_owned(), vec![]).unwrap_or(format!(""))) { Err(e) => return Err(StringError::new("Failed to clear screen", Some(Box::new(e)))), Ok(_) => { trace!("Cleared screen successfully"); } } // flush the output match output.flush() { Ok(_) => { trace!("Successfully flushed output"); }, Err(e) => { return Err(StringError::new("Failed to flush output", Some(Box::new(e)))); } } if !stopped { match best_match { Some(m) => { try!(self.insert_match(m.into_owned())); }, None => { trace!("Not inserting best match"); } } } // Return success // Preferably, don't read stdin after this Ok(()) } } // this thread waits for queries, and responds with search matches pub fn search_thread(query: Receiver<String>, matches: Sender<Vec<Cow<'static, str>>>) { debug!("Starting query thread"); debug!("Getting history path"); let history_path = match env::var("HISTFILE") { Ok(p) => { trace!("Got history path: {:?}", p); p }, Err(e) => panic!("Failed to get bash history file: {}", e) }; let mut base = SearchBase::default(); // read the history info!("Reading history"); match base.read_history(history_path) { Ok(_) => { // success }, Err(e) => { panic!("Failed to read history: {}", e) } } debug!("Starting query loop"); loop { trace!("Waiting for a query"); match query.recv() { Err(e) => { debug!("Search thread exiting: {}", e); break; }, Ok(q) => { debug!("Got query: {:?}", q); let result = base.query(q); debug!("Got result: {:?}", result); match matches.send(result) { Err(e) => { debug!("Search thread exiting: {}", e); break; }, Ok(_) => { trace!("Matches sent successfully"); } } } } } } // this thread waits for input on stdin and sends that input back fn input_thread(chars: Sender<char>, stop: Receiver<()>) { debug!("Starting input thread"); debug!("Getting stdin lock"); let handle = io::stdin(); let input = handle.lock(); for maybe_chr in input.chars() { // see if a stop has been requested match stop.try_recv() { Err(_) => { trace!("Not stopping thread"); }, Ok(_) => { debug!("Input thread exiting"); break; } } match maybe_chr { Err(e) => { debug!("Input thread exiting: {}", e); break; }, Ok(c) => { debug!("Got character: {:?}", c); match chars.send(c) { Err(e) => { debug!("Search thread exiting: {:?}", e); }, Ok(_) => { trace!("Character sent successfully"); } } } } } debug!("Input thread ran out of input"); } // this thread waits for interrupt signals so we can exit cleanly fn signal_thread(stop: Sender<()>) { debug!("Starting signal thread"); match ::bis_c::mask_sigint() { Ok(_) => { trace!("Set signal mask successfully"); }, Err(e) => { panic!("Error setting signal mask: {:?}", e); } } match ::bis_c::wait_sigint() { Ok(_) => { trace!("Waited for signal successfully"); }, Err(e) => { panic!("Error waiting for signal: {:?}", e); } } match stop.send(()) { Ok(_) => { trace!("Sent stop signal successfully"); }, Err(e) => { // this doesn't necessarily mean an error debug!("Stop thread failed to send: {:?}", e); } } debug!("Thread got interrupt signal, exiting"); }
use color_frame::ColorFrame; use rustual_boy_core::sinks::Sink; use rustual_boy_core::vip::DISPLAY_PIXELS; /// A utility for adjusting a ColorFrame's gamma curve. /// Typically used with a gamma of 2.2 to prepare a linear /// buffer for sRGB pixel output. pub struct GammaAdjustSink<T: Sink<ColorFrame>> { inner: T, gamma_table: Box<[u8; 256]>, } impl<T: Sink<ColorFrame>> GammaAdjustSink<T> { /// Create a new GammaAdjustSink which will use the provided gamma /// value for adjustment (typically 2.2 for basic RGB -> sRGB /// conversion). pub fn new(inner: T, gamma: f64) -> GammaAdjustSink<T> { let mut gamma_table = Box::new([0; 256]); for (i, entry) in gamma_table.iter_mut().enumerate() { let mut value = (((i as f64) / 255.0).powf(1.0 / gamma) * 255.0) as isize; if value < 0 { value = 0; } if value > 255 { value = 0; } *entry = value as u8; } GammaAdjustSink { inner: inner, gamma_table: gamma_table, } } pub fn into_inner(self) -> T { self.inner } } impl<T: Sink<ColorFrame>> Sink<ColorFrame> for GammaAdjustSink<T> { fn append(&mut self, frame: ColorFrame) { let mut output = Vec::new(); output.reserve_exact(DISPLAY_PIXELS); unsafe { let input_buffer_ptr = frame.as_ptr(); { let output_buffer_ptr = output.as_mut_ptr(); for i in 0..(DISPLAY_PIXELS as isize) { let ref input = *(input_buffer_ptr.offset(i)); let (input_r, input_g, input_b) = input.into(); let output_r = self.gamma_table[input_r as usize]; let output_g = self.gamma_table[input_g as usize]; let output_b = self.gamma_table[input_b as usize]; *output_buffer_ptr.offset(i) = (output_r, output_g, output_b).into(); } } output.set_len(DISPLAY_PIXELS); } self.inner.append(output.into_boxed_slice()); } }
// Copyright 2021 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. mod catch_unwind; mod global_runtime; #[allow(clippy::module_inception)] mod runtime; mod runtime_tracker; mod thread; mod thread_pool; pub use catch_unwind::catch_unwind; pub use catch_unwind::CatchUnwindFuture; pub use global_runtime::GlobalIORuntime; pub use global_runtime::GlobalQueryRuntime; pub use runtime::execute_futures_in_parallel; pub use runtime::match_join_handle; pub use runtime::Dropper; pub use runtime::Runtime; pub use runtime::TrySpawn; pub use runtime_tracker::set_alloc_error_hook; pub use runtime_tracker::LimitMemGuard; pub use runtime_tracker::MemStat; pub use runtime_tracker::ThreadTracker; pub use runtime_tracker::TrackedFuture; pub use runtime_tracker::UnlimitedFuture; pub use runtime_tracker::GLOBAL_MEM_STAT; pub use thread::Thread; pub use thread::ThreadJoinHandle; pub use thread_pool::TaskJoinHandler; pub use thread_pool::ThreadPool;
use std::ops::{Add, Div, Index, Mul, Neg, Sub}; use rand::Rng; use rand::distributions::Standard; use rand::prelude::Distribution; #[derive(Debug)] pub enum Axis { X, Y, Z } impl Distribution<Axis> for Standard { fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Axis { match rng.gen_range(0..=2) { 0 => Axis::X, 1 => Axis::Y, _ => Axis::Z, } } } #[derive(Clone, Copy, Debug)] pub struct Vec3 { pub x: f64, pub y: f64, pub z: f64, } impl Vec3 { pub const ONE: Vec3 = Vec3 { x: 1.0, y: 1.0, z: 1.0, }; pub const ZERO: Vec3 = Vec3 { x: 0.0, y: 0.0, z: 0.0, }; pub const RIGHT: Vec3 = Vec3 { x: 1.0, y: 0.0, z: 0.0, }; pub const UP: Vec3 = Vec3 { x: 0.0, y: 1.0, z: 0.0, }; pub const FORWARD: Vec3 = Vec3 { x: 0.0, y: 0.0, z: 1.0, }; pub fn new<T, U, V>(x: T, y: U, z: V) -> Self where T: Into<f64> + Copy, U: Into<f64> + Copy, V: Into<f64> + Copy, { Self { x: x.into(), y: y.into(), z: z.into(), } } pub fn random<T, U>(min: T, max: U) -> Self where T: Into<f64> + Copy, U: Into<f64> + Copy, { let mut rng = rand::thread_rng(); Self { x: rng.gen_range(min.into()..max.into()), y: rng.gen_range(min.into()..max.into()), z: rng.gen_range(min.into()..max.into()), } } pub fn random_in_unit_sphere() -> Self { loop { let p = Vec3::random(-1, 1); if p.length_squared() < 1.0 { return p; } } } pub fn random_unit_vector() -> Self { Vec3::random_in_unit_sphere().normalize() } pub fn random_in_unit_disk() -> Self { let mut rng = rand::thread_rng(); loop { let p = Vec3 { x: rng.gen_range(-1.0..1.0), y: rng.gen_range(-1.0..1.0), z: 0.0, }; if p.length_squared() < 1.0 { return p; } } } pub fn write_color<T>(self, samples_per_pixel: T) where T: Into<f64> + Copy, { let scale = 1.0 / samples_per_pixel.into(); let scaled_r = (self.x * scale).sqrt(); let scaled_g = (self.y * scale).sqrt(); let scaled_b = (self.z * scale).sqrt(); let ir = (255.999 * scaled_r.clamp(0.0, 0.999)) as u8; let ig = (255.999 * scaled_g.clamp(0.0, 0.999)) as u8; let ib = (255.999 * scaled_b.clamp(0.0, 0.999)) as u8; println!("{} {} {}", ir, ig, ib); } pub fn length_squared(&self) -> f64 { self.x * self.x + self.y * self.y + self.z * self.z } pub fn length(&self) -> f64 { self.length_squared().sqrt() } pub fn normalize(&self) -> Self { let length = self.length(); Self { x: self.x / length, y: self.y / length, z: self.z / length, } } pub fn dot(&self, other: Vec3) -> f64 { self.x * other.x + self.y * other.y + self.z * other.z } pub fn cross(&self, other: Vec3) -> Vec3 { Vec3 { x: self.y * other.z - self.z * other.y, y: self.z * other.x - self.x * other.z, z: self.x * other.y - self.y * other.x, } } pub fn near_zero(&self) -> bool { let eps = 1e-8; self.x.abs() < eps && self.y.abs() < eps && self.z.abs() < eps } pub fn reflect(&self, axis: Vec3) -> Vec3 { self - 2.0 * self.dot(axis) * axis } pub fn refract(&self, normal: Vec3, ratio: f64) -> Vec3 { let cos_theta = (-self).dot(normal).min(1.0); let perp = ratio * (self + cos_theta * normal); let parallel = (1.0 - perp.length_squared()).abs().sqrt() * -1.0 * normal; perp + parallel } } impl<'a> Index<&'a Axis> for Vec3 { type Output = f64; fn index(&self, axis: &'a Axis) -> &Self::Output { match axis { Axis::X => &self.x, Axis::Y => &self.y, Axis::Z => &self.z, } } } // This macro helps us implement math operators on Vector3 // in such a way that it handles binary operators on any // combination of Vec3, &Vec3 and f64. macro_rules! impl_binary_operations { // $Operation is something like `Add` // $op_fn is something like `add` // $op_symbol is something like `+` ($Operation:ident $op_fn:ident $op_symbol:tt) => { // Implement a + b where a and b are both of type &Vec3. impl<'a, 'b> $Operation<&'a Vec3> for &'b Vec3 { type Output = Vec3; fn $op_fn(self, other: &'a Vec3) -> Vec3 { Vec3 { x: self.x $op_symbol other.x, y: self.y $op_symbol other.y, z: self.z $op_symbol other.z, } } } // Implement a op b for the cases... // // a: Vec3, b: &Vec3 // a: &Vec3, b: Vec3 // a: Vec3, b: Vec3 // // In each case we forward through to the implementation above. impl $Operation<Vec3> for Vec3 { type Output = Vec3; #[inline] fn $op_fn(self, other: Vec3) -> Vec3 { &self $op_symbol &other } } impl<'a> $Operation<&'a Vec3> for Vec3 { type Output = Vec3; #[inline] fn $op_fn(self, other: &'a Vec3) -> Vec3 { &self $op_symbol other } } impl<'a> $Operation<Vec3> for &'a Vec3 { type Output = Vec3; #[inline] fn $op_fn(self, other: Vec3) -> Vec3 { self $op_symbol &other } } // Implement a + b where a is type &Vec3 and b is type Into<f64> impl<'a, T> $Operation<T> for &'a Vec3 where T: Into<f64> + Copy { type Output = Vec3; fn $op_fn(self, other: T) -> Vec3 { Vec3 { x: self.x $op_symbol other.into(), y: self.y $op_symbol other.into(), z: self.z $op_symbol other.into(), } } } // Implement a + b where... // // a is Vec3 and b is f64 // a is f64 and b is Vec3 // a is f64 and b is &Vec3 // // In each case we forward the logic to the implementation // above. impl<T> $Operation<T> for Vec3 where T: Into<f64> + Copy { type Output = Vec3; #[inline] fn $op_fn(self, other: T) -> Vec3 { &self $op_symbol other } } impl $Operation<Vec3> for f64 { type Output = Vec3; #[inline] fn $op_fn(self, other: Vec3) -> Vec3 { &other $op_symbol self } } impl<'a> $Operation<&'a Vec3> for f64 { type Output = Vec3; #[inline] fn $op_fn(self, other: &'a Vec3) -> Vec3 { other $op_symbol self } } }; } macro_rules! impl_unary_operators { // $Operation is something like `Add` // $op_fn is something like `add` // $op_symbol is something like `+` ($Operation:ident $op_fn:ident $op_symbol:tt) => { impl<'a> $Operation for &'a Vec3 { type Output = Vec3; fn $op_fn(self) -> Vec3 { Vec3 { x: $op_symbol self.x, y: $op_symbol self.y, z: $op_symbol self.z, } } } impl $Operation for Vec3 { type Output = Vec3; fn $op_fn(self) -> Vec3 { $op_symbol &self } } }; } impl_binary_operations!(Add add +); impl_binary_operations!(Sub sub -); impl_binary_operations!(Mul mul *); impl_binary_operations!(Div div /); impl_unary_operators!(Neg neg -);
use crate::Error; use std::fmt; /// A constant value. #[derive(Clone, Hash, PartialEq, Eq)] pub enum Constant { /// The unit constant (always has constant id = 0). Unit, /// A boolean constant. Bool(bool), /// A character constant. Char(char), /// A byte constant. Byte(u8), /// An integer constant. Integer(i64), /// A float constant. Float(ordered_float::NotNan<f64>), /// A string constant. String(Box<str>), /// A byte constant. Bytes(Box<[u8]>), } impl Constant { /// Construct a float constant and error if it can't be constructed. pub fn float(f: f64) -> Result<Self, Error> { let f = ordered_float::NotNan::new(f).map_err(|_| Error::FloatIsNan)?; Ok(Self::Float(f)) } } impl fmt::Debug for Constant { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Constant::Unit => { write!(f, "()")?; } Constant::Bool(b) => { write!(f, "{}", b)?; } Constant::Char(c) => { write!(f, "{:?}", c)?; } Constant::Byte(b) => { write!(f, "0x{:02x}", b)?; } Constant::Integer(n) => { write!(f, "{}", n)?; } Constant::Float(n) => { write!(f, "{}", n.into_inner())?; } Constant::String(s) => { write!(f, "{:?}", s)?; } Constant::Bytes(b) => { write!(f, "{:?}", b)?; } } Ok(()) } }
use bytemuck::{Pod, Zeroable}; #[derive(Copy, Clone, Debug, Pod, Zeroable)] #[repr(C)] pub struct Pos { pub x: f32, pub y: f32, pub z: f32, } impl Pos { pub const fn new(x: f32, y: f32, z: f32) -> Self { Self { x, y, z } } } #[derive(Copy, Clone, Debug, Pod, Zeroable)] #[repr(C)] pub struct Uv { pub u: f32, pub v: f32, } #[derive(Copy, Clone, Debug, Pod, Zeroable)] #[repr(C)] pub struct Vertex { pub pos: Pos, pub uv: Uv, } impl Vertex { pub const fn new(pos: Pos, uv: Uv) -> Self { Vertex { pos, uv } } pub const fn vb_layout() -> wgpu::VertexBufferLayout<'static> { const ATTRIBS: [wgpu::VertexAttribute; 2] = wgpu::vertex_attr_array![0 => Float32x3, 1 => Float32x2]; wgpu::VertexBufferLayout { array_stride: std::mem::size_of::<Vertex>() as _, step_mode: wgpu::VertexStepMode::Vertex, attributes: &ATTRIBS, } } }
mod conversions; pub use crate::conversions::celsisus::from_celsisus; pub use crate::conversions::fahrenheit::from_farenheight; pub use crate::conversions::kelvin::from_kelvin; pub use crate::conversions::temp_units::units;
use clap::ArgMatches; use asciii::actions::setup_luigi_with_git; use asciii::util; use ::cli::execute; use super::matches_to_paths; /// Command LOG pub fn git_log() { let luigi = execute(setup_luigi_with_git); let repo = luigi.repository().unwrap(); if !repo.log().success() { error!("git log did not exit successfully") } } /// Command STATUS pub fn git_status() { let luigi = execute(setup_luigi_with_git); let repo = luigi.repository().unwrap(); if !repo.status().success() { error!("git status did not exit successfully") } } /// Command COMMIT pub fn git_commit() { let luigi = execute(setup_luigi_with_git); let repo = luigi.repository().unwrap(); if !repo.commit().success() { error!("git commit did not exit successfully") } } /// Command REMOTE /// exact replica of `git remote -v` #[cfg(not(feature="git_statuses"))] pub fn git_remote() { let luigi = execute(setup_luigi_with_git); luigi.repository().unwrap().remote(); } /// Command REMOTE /// exact replica of `git remote -v` #[cfg(feature="git_statuses")] pub fn git_remote() { let luigi = execute(setup_luigi_with_git); if let Some(r) = luigi.repository() { let ref repo = r.repo; for remote_name in repo.remotes().unwrap().iter() { if let Some(name) = remote_name { if let Ok(remote) = repo.find_remote(name) { println!("{} {} (fetch)\n{} {} (push)", remote.name().unwrap_or("no name"), remote.url().unwrap_or("no url"), remote.name().unwrap_or("no name"), remote.pushurl().or(remote.url()).unwrap_or(""), ); } else { println!("no remote") } } else { println!("no remote name") } } } } /// Command ADD pub fn git_add(matches: &ArgMatches) { let luigi = execute(setup_luigi_with_git); let paths = matches_to_paths(matches, &luigi); let repo = luigi.repository().unwrap(); if !repo.add(&paths).success() { error!("git add did not exit successfully") } } /// Command DIFF pub fn git_diff(matches: &ArgMatches) { let luigi = execute(setup_luigi_with_git); let paths = matches_to_paths(matches, &luigi); let repo = luigi.repository().unwrap(); if !repo.diff(&paths).success() { error!("git diff did not exit successfully") } } /// Command PULL pub fn git_pull(matches: &ArgMatches) { let luigi = execute(setup_luigi_with_git); let repo = luigi.repository().unwrap(); let success = if matches.is_present("rebase") { repo.pull_rebase().success() } else { repo.pull().success() }; if !success { error!("git pull did not exit successfully") } } /// Command PUSH pub fn git_push() { let luigi = execute(setup_luigi_with_git); let repo = luigi.repository().unwrap(); if !repo.push().success() { error!("git push did not exit successfully") } } /// Command STASH pub fn git_stash() { let luigi = execute(setup_luigi_with_git); let repo = luigi.repository().unwrap(); if !repo.stash().success() { error!("git stash did not exit successfully") } } /// Command CLEANUP pub fn git_cleanup(matches: &ArgMatches) { let luigi = execute(setup_luigi_with_git); let paths = matches_to_paths(matches, &luigi); let repo = luigi.repository().unwrap(); // TODO implement `.and()` for exitstatus if util::really(&format!( "Do you really want to reset any changes you made to:\n {:?}\n[y|N]", paths)) { if !(repo.checkout(&paths).success() && repo.clean(&paths).success()) { error!("clean was not successfull"); } } } /// Command STASH POP pub fn git_stash_pop() { let luigi = execute(setup_luigi_with_git); let repo = luigi.repository().unwrap(); if !repo.stash_pop().success() { error!("git stash pop did not exit successfully") } }
#[doc = "Reader of register DAC_SR"] pub type R = crate::R<u32, super::DAC_SR>; #[doc = "Writer for register DAC_SR"] pub type W = crate::W<u32, super::DAC_SR>; #[doc = "Register DAC_SR `reset()`'s with value 0"] impl crate::ResetValue for super::DAC_SR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `DMAUDR1`"] pub type DMAUDR1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DMAUDR1`"] pub struct DMAUDR1_W<'a> { w: &'a mut W, } impl<'a> DMAUDR1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13); self.w } } #[doc = "Reader of field `CAL_FLAG1`"] pub type CAL_FLAG1_R = crate::R<bool, bool>; #[doc = "Reader of field `BWST1`"] pub type BWST1_R = crate::R<bool, bool>; #[doc = "Reader of field `DMAUDR2`"] pub type DMAUDR2_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DMAUDR2`"] pub struct DMAUDR2_W<'a> { w: &'a mut W, } impl<'a> DMAUDR2_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29); self.w } } #[doc = "Reader of field `CAL_FLAG2`"] pub type CAL_FLAG2_R = crate::R<bool, bool>; #[doc = "Reader of field `BWST2`"] pub type BWST2_R = crate::R<bool, bool>; impl R { #[doc = "Bit 13 - DAC channel1 DMA underrun flag This bit is set by hardware and cleared by software (by writing it to 1)."] #[inline(always)] pub fn dmaudr1(&self) -> DMAUDR1_R { DMAUDR1_R::new(((self.bits >> 13) & 0x01) != 0) } #[doc = "Bit 14 - DAC Channel 1 calibration offset status This bit is set and cleared by hardware"] #[inline(always)] pub fn cal_flag1(&self) -> CAL_FLAG1_R { CAL_FLAG1_R::new(((self.bits >> 14) & 0x01) != 0) } #[doc = "Bit 15 - DAC Channel 1 busy writing sample time flag This bit is systematically set just after Sample & Hold mode enable and is set each time the software writes the register DAC_SHSR1, It is cleared by hardware when the write operation of DAC_SHSR1 is complete. (It takes about 3LSI periods of synchronization)."] #[inline(always)] pub fn bwst1(&self) -> BWST1_R { BWST1_R::new(((self.bits >> 15) & 0x01) != 0) } #[doc = "Bit 29 - DAC channel2 DMA underrun flag This bit is set by hardware and cleared by software (by writing it to 1)."] #[inline(always)] pub fn dmaudr2(&self) -> DMAUDR2_R { DMAUDR2_R::new(((self.bits >> 29) & 0x01) != 0) } #[doc = "Bit 30 - DAC Channel 2 calibration offset status This bit is set and cleared by hardware"] #[inline(always)] pub fn cal_flag2(&self) -> CAL_FLAG2_R { CAL_FLAG2_R::new(((self.bits >> 30) & 0x01) != 0) } #[doc = "Bit 31 - DAC Channel 2 busy writing sample time flag This bit is systematically set just after Sample & Hold mode enable and is set each time the software writes the register DAC_SHSR2, It is cleared by hardware when the write operation of DAC_SHSR2 is complete. (It takes about 3 LSI periods of synchronization)."] #[inline(always)] pub fn bwst2(&self) -> BWST2_R { BWST2_R::new(((self.bits >> 31) & 0x01) != 0) } } impl W { #[doc = "Bit 13 - DAC channel1 DMA underrun flag This bit is set by hardware and cleared by software (by writing it to 1)."] #[inline(always)] pub fn dmaudr1(&mut self) -> DMAUDR1_W { DMAUDR1_W { w: self } } #[doc = "Bit 29 - DAC channel2 DMA underrun flag This bit is set by hardware and cleared by software (by writing it to 1)."] #[inline(always)] pub fn dmaudr2(&mut self) -> DMAUDR2_W { DMAUDR2_W { w: self } } }
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); #[cfg(test)] mod tests { use super::*; use std::mem; use std::ptr; use std::ffi::CString; use std::ffi::CStr; #[test] fn constants() { assert_eq!( CUPS_FORMAT_TEXT, CString::new("text/plain").unwrap().as_bytes_with_nul() ); assert_eq!(CUPS_JOBID_CURRENT, 0); } #[test] fn list_printers() { unsafe { let mut dests: *mut cups_dest_t = mem::zeroed(); let num_dests = cupsGetDests(&mut dests as *mut _); std::slice::from_raw_parts(dests, num_dests as usize); cupsFreeDests(num_dests, dests); } } #[test] fn default_printer() { unsafe { let mut dests: *mut cups_dest_t = mem::zeroed(); let num_dests = cupsGetDests(&mut dests as *mut _); cupsGetDest(ptr::null(), ptr::null(), num_dests, dests); cupsFreeDests(num_dests, dests); } } #[test] fn printer_info() { unsafe { let mut dests: *mut cups_dest_t = mem::zeroed(); let num_dests = cupsGetDests(&mut dests as *mut _); let destinations = std::slice::from_raw_parts(dests, num_dests as usize); for destination in destinations { let c_printer_name = CStr::from_ptr((*destination).name); let printer_name = c_printer_name.to_string_lossy(); let c_make_and_model = cupsGetOption( CString::new("printer-make-and-model").unwrap().as_ptr(), destination.num_options, destination.options, ); let make_and_model = CStr::from_ptr(c_make_and_model).to_string_lossy(); println!("{} ({})", printer_name, make_and_model); cupsFreeDests(num_dests, dests); } } } #[test] #[ignore] fn test_print_page() { unsafe { let mut dests: *mut cups_dest_t = mem::zeroed(); let num_dests = cupsGetDests(&mut dests as *mut _); let destinations = std::slice::from_raw_parts(dests, num_dests as usize); for dest in destinations { let printer_name = CStr::from_ptr((*dest).name).to_string_lossy(); let make_and_model = CStr::from_ptr(cupsGetOption( CString::new("printer-make-and-model").unwrap().as_ptr(), dest.num_options, dest.options, )).to_string_lossy(); println!("{} ({})", printer_name, make_and_model); let job_id: i32 = cupsPrintFile( dest.name, CString::new("./test-resources/testPrintFile.txt") .unwrap() .as_ptr(), CString::new("Test Print").unwrap().as_ptr(), dest.num_options, dest.options, ); println!("{}", job_id); cupsFreeDests(num_dests, dests); } } } }
use franklin_crypto::bellman::pairing::ff::{Field, PrimeField}; use franklin_crypto::bellman::pairing::Engine; // Substitution box is non-linear part of permutation function. // It basically computes power of each element in the state. // Usually value of alpha is either 5 or 3. We keep a generic // handler other values of alpha. pub(crate) fn sbox<E: Engine>(alpha: E::Fr, state: &mut [E::Fr]) { match alpha.into_repr().as_ref()[0] { 5 => { for el in state.iter_mut() { let mut quad = *el; quad.square(); quad.square(); el.mul_assign(&quad); } }, 3 => { for el in state.iter_mut() { let mut quad = *el; quad.square(); el.mul_assign(&quad); } }, _ => { for el in state.iter_mut() { *el = el.pow(alpha.into_repr()); } } } }
use dynasm::dynasm; use dynasmrt::{x64::Assembler, DynasmApi}; // TODO: NOP generator <https://stackoverflow.com/a/36361832/4696352> pub(crate) fn assemble_read4(code: &mut Assembler, reg: usize, address: usize) { assert!(address <= (u32::max_value() as usize)); dynasm!(code; mov Rd(reg as u8), DWORD [address as i32]); } pub(crate) fn assemble_literal(code: &mut Assembler, reg: usize, literal: u64) { // TODO: XOR for zero? if literal <= u32::max_value().into() { dynasm!(code; mov Rd(reg as u8), DWORD literal as i32); } else { dynasm!(code; mov Rq(reg as u8), QWORD literal as i64); } } pub(crate) fn assemble_mov(code: &mut Assembler, reg: usize, src: usize) { dynasm!(code; mov Rq(reg as u8), Rq(src as u8)); } pub(crate) fn assemble_read(code: &mut Assembler, reg: usize, index: usize) { let offset = (8 + 8 * index) as i32; dynasm!(code; mov Rq(reg as u8), QWORD [r0 + offset]); } // TODO: Look into using PUSH instructions to write closures and POP to read // them. While we are at it we could use `RET` instead of `JMP *r0`. pub(crate) fn assemble_write_const(code: &mut Assembler, reg: usize, offset: usize, value: u64) { let offset = offset as i32; if value <= u32::max_value().into() { dynasm!(code; mov QWORD [Rq(reg as u8) + offset], DWORD value as i32); } else { // TODO: Avoid r15 clobber, could use two 32 bit writes dynasm!(code ; mov r15, QWORD value as i64 ; mov QWORD [Rq(reg as u8) + offset], r15 ); } } pub(crate) fn assemble_write_reg(code: &mut Assembler, reg: usize, offset: usize, src: usize) { let offset = offset as i32; dynasm!(code; mov QWORD [Rq(reg as u8) + offset], Rq(src as u8)); } pub(crate) fn assemble_write_read(code: &mut Assembler, reg: usize, offset: usize, index: usize) { // TODO: Don't clobber r15 let read_offset = (8 + 8 * index) as i32; let write_offset = offset as i32; dynasm!(code ; mov r15, QWORD [r0 + read_offset] ; mov QWORD [Rq(reg as u8) + write_offset], r15 ); }
use rust_algorithms::linked_list::List; use rust_algorithms::linked_list::List::{Nil, Cons}; use rust_algorithms::linked_list; /// True if the list contains a pair of different elements that add to `total`. fn has_pair_adding_to(total : i32, xs : &List<i32>) -> bool { fn mapper(xs : &List<i32>) -> List<i32> { match xs { Nil => Nil, Cons(x, xss) => linked_list::map(|a| {x + a}, xss) } } let sums : List<i32> = linked_list::concat_map(mapper, &linked_list::tails(xs)); return linked_list::elem(total, &sums); } fn main() { let list : List<i32> = linked_list::range(10); println!("{:?}", list); println!("{}", linked_list::elem(5, &list)); println!("{}", has_pair_adding_to(17, &list)); println!("{}", has_pair_adding_to(69, &list)); }
use arrow_util::assert_batches_eq; use data_types::{StatValues, Statistics}; use mutable_batch::{writer::Writer, MutableBatch, TimestampSummary}; use schema::Projection; use std::num::NonZeroU64; fn get_stats(batch: &MutableBatch) -> Vec<(&str, Statistics)> { let mut stats: Vec<_> = batch .columns() .map(|(name, col)| (name.as_str(), col.stats())) .collect(); stats.sort_unstable_by(|(a, _), (b, _)| a.cmp(b)); stats } #[test] fn test_basic() { let mut batch = MutableBatch::new(); let mut writer = Writer::new(&mut batch, 5); writer .write_bool( "b1", None, vec![true, true, false, false, false].into_iter(), ) .unwrap(); writer .write_bool( "b2", Some(&[0b00011101]), vec![true, false, false, true].into_iter(), ) .unwrap(); writer .write_f64( "f64", Some(&[0b00011011]), vec![343.3, 443., 477., -24.].into_iter(), ) .unwrap(); writer .write_i64("i64", None, vec![234, 6, 2, 6, -3].into_iter()) .unwrap(); writer .write_i64("i64_2", Some(&[0b00000001]), vec![-8].into_iter()) .unwrap(); writer .write_u64("u64", Some(&[0b00001001]), vec![23, 5].into_iter()) .unwrap(); writer .write_time("time", vec![7, 5, 7, 3, 5].into_iter()) .unwrap(); writer .write_tag("tag1", None, vec!["v1", "v1", "v2", "v2", "v1"].into_iter()) .unwrap(); writer .write_tag( "tag2", Some(&[0b00001011]), vec!["v1", "v2", "v2"].into_iter(), ) .unwrap(); writer .write_tag_dict( "tag3", Some(&[0b00011011]), vec![1, 0, 0, 1].into_iter(), vec!["v1", "v2"].into_iter(), ) .unwrap(); writer.commit(); let stats: Vec<_> = get_stats(&batch); let expected_data = &[ "+-------+-------+-------+-----+-------+------+------+------+--------------------------------+-----+", "| b1 | b2 | f64 | i64 | i64_2 | tag1 | tag2 | tag3 | time | u64 |", "+-------+-------+-------+-----+-------+------+------+------+--------------------------------+-----+", "| true | true | 343.3 | 234 | -8 | v1 | v1 | v2 | 1970-01-01T00:00:00.000000007Z | 23 |", "| true | | 443.0 | 6 | | v1 | v2 | v1 | 1970-01-01T00:00:00.000000005Z | |", "| false | false | | 2 | | v2 | | | 1970-01-01T00:00:00.000000007Z | |", "| false | false | 477.0 | 6 | | v2 | v2 | v1 | 1970-01-01T00:00:00.000000003Z | 5 |", "| false | true | -24.0 | -3 | | v1 | | v2 | 1970-01-01T00:00:00.000000005Z | |", "+-------+-------+-------+-----+-------+------+------+------+--------------------------------+-----+", ]; let expected_stats = vec![ ( "b1", Statistics::Bool(StatValues::new(Some(false), Some(true), 5, Some(0))), ), ( "b2", Statistics::Bool(StatValues::new(Some(false), Some(true), 5, Some(1))), ), ( "f64", Statistics::F64(StatValues::new(Some(-24.), Some(477.), 5, Some(1))), ), ( "i64", Statistics::I64(StatValues::new(Some(-3), Some(234), 5, Some(0))), ), ( "i64_2", Statistics::I64(StatValues::new(Some(-8), Some(-8), 5, Some(4))), ), ( "tag1", Statistics::String(StatValues::new_with_distinct( Some("v1".to_string()), Some("v2".to_string()), 5, Some(0), Some(NonZeroU64::new(2).unwrap()), )), ), ( "tag2", Statistics::String(StatValues::new_with_distinct( Some("v1".to_string()), Some("v2".to_string()), 5, Some(2), Some(NonZeroU64::new(3).unwrap()), )), ), ( "tag3", Statistics::String(StatValues::new_with_distinct( Some("v1".to_string()), Some("v2".to_string()), 5, Some(1), Some(NonZeroU64::new(3).unwrap()), )), ), ( "time", Statistics::I64(StatValues::new(Some(3), Some(7), 5, Some(0))), ), ( "u64", Statistics::U64(StatValues::new(Some(5), Some(23), 5, Some(3))), ), ]; assert_batches_eq!(expected_data, &[batch.to_arrow(Projection::All).unwrap()]); assert_eq!(stats, expected_stats); let mut writer = Writer::new(&mut batch, 4); writer .write_time("time", vec![4, 6, 21, 7].into_iter()) .unwrap(); writer .write_tag("tag1", None, vec!["v6", "v7", "v8", "v4"].into_iter()) .unwrap(); std::mem::drop(writer); let stats: Vec<_> = get_stats(&batch); // Writer dropped, should not impact stats or data assert_batches_eq!(expected_data, &[batch.to_arrow(Projection::All).unwrap()]); assert_eq!(stats, expected_stats); let err = Writer::new(&mut batch, 1) .write_tag("b1", None, vec!["err"].into_iter()) .unwrap_err() .to_string(); assert_eq!(err.as_str(), "Unable to insert iox::column_type::tag type into column b1 with type iox::column_type::field::boolean"); let err = Writer::new(&mut batch, 1) .write_i64("f64", None, vec![3].into_iter()) .unwrap_err() .to_string(); assert_eq!(err.as_str(), "Unable to insert iox::column_type::field::integer type into column f64 with type iox::column_type::field::float"); let err = Writer::new(&mut batch, 1) .write_string("tag3", None, vec!["sd"].into_iter()) .unwrap_err() .to_string(); assert_eq!(err.as_str(), "Unable to insert iox::column_type::field::string type into column tag3 with type iox::column_type::tag"); let err = Writer::new(&mut batch, 1) .write_tag_dict("tag3", None, vec![1].into_iter(), vec!["v1"].into_iter()) .unwrap_err() .to_string(); assert_eq!(err.as_str(), "Key not found in dictionary: 1"); let stats: Vec<_> = get_stats(&batch); // Writer not committed, should not impact stats or data assert_batches_eq!(expected_data, &[batch.to_arrow(Projection::All).unwrap()]); assert_eq!(stats, expected_stats); let mut writer = Writer::new(&mut batch, 17); writer.write_time("time", 0..17).unwrap(); writer .write_f64( "f64", Some(&[0b01000010, 0b00100100, 0b00000001]), vec![4., 945., -222., 4., 7.].into_iter(), ) .unwrap(); writer .write_tag("tag3", None, std::iter::repeat("v2")) .unwrap(); writer .write_tag_dict( "tag2", Some(&[0b11011111, 0b11011101, 0b00000000]), vec![0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1].into_iter(), vec!["v4", "v1", "v7"].into_iter(), // Intentional extra key ) .unwrap(); writer.commit(); let stats: Vec<_> = get_stats(&batch); let expected_data = &[ "+-------+-------+--------+-----+-------+------+------+------+--------------------------------+-----+", "| b1 | b2 | f64 | i64 | i64_2 | tag1 | tag2 | tag3 | time | u64 |", "+-------+-------+--------+-----+-------+------+------+------+--------------------------------+-----+", "| true | true | 343.3 | 234 | -8 | v1 | v1 | v2 | 1970-01-01T00:00:00.000000007Z | 23 |", "| true | | 443.0 | 6 | | v1 | v2 | v1 | 1970-01-01T00:00:00.000000005Z | |", "| false | false | | 2 | | v2 | | | 1970-01-01T00:00:00.000000007Z | |", "| false | false | 477.0 | 6 | | v2 | v2 | v1 | 1970-01-01T00:00:00.000000003Z | 5 |", "| false | true | -24.0 | -3 | | v1 | | v2 | 1970-01-01T00:00:00.000000005Z | |", "| | | | | | | v4 | v2 | 1970-01-01T00:00:00Z | |", "| | | 4.0 | | | | v1 | v2 | 1970-01-01T00:00:00.000000001Z | |", "| | | | | | | v1 | v2 | 1970-01-01T00:00:00.000000002Z | |", "| | | | | | | v4 | v2 | 1970-01-01T00:00:00.000000003Z | |", "| | | | | | | v1 | v2 | 1970-01-01T00:00:00.000000004Z | |", "| | | | | | | | v2 | 1970-01-01T00:00:00.000000005Z | |", "| | | 945.0 | | | | v1 | v2 | 1970-01-01T00:00:00.000000006Z | |", "| | | | | | | v1 | v2 | 1970-01-01T00:00:00.000000007Z | |", "| | | | | | | v4 | v2 | 1970-01-01T00:00:00.000000008Z | |", "| | | | | | | | v2 | 1970-01-01T00:00:00.000000009Z | |", "| | | -222.0 | | | | v4 | v2 | 1970-01-01T00:00:00.000000010Z | |", "| | | | | | | v4 | v2 | 1970-01-01T00:00:00.000000011Z | |", "| | | | | | | v4 | v2 | 1970-01-01T00:00:00.000000012Z | |", "| | | 4.0 | | | | | v2 | 1970-01-01T00:00:00.000000013Z | |", "| | | | | | | v1 | v2 | 1970-01-01T00:00:00.000000014Z | |", "| | | | | | | v1 | v2 | 1970-01-01T00:00:00.000000015Z | |", "| | | 7.0 | | | | | v2 | 1970-01-01T00:00:00.000000016Z | |", "+-------+-------+--------+-----+-------+------+------+------+--------------------------------+-----+", ]; let expected_stats = vec![ ( "b1", Statistics::Bool(StatValues::new(Some(false), Some(true), 22, Some(17))), ), ( "b2", Statistics::Bool(StatValues::new(Some(false), Some(true), 22, Some(18))), ), ( "f64", Statistics::F64(StatValues::new(Some(-222.), Some(945.), 22, Some(13))), ), ( "i64", Statistics::I64(StatValues::new(Some(-3), Some(234), 22, Some(17))), ), ( "i64_2", Statistics::I64(StatValues::new(Some(-8), Some(-8), 22, Some(21))), ), ( "tag1", Statistics::String(StatValues::new_with_distinct( Some("v1".to_string()), Some("v2".to_string()), 22, Some(17), Some(NonZeroU64::new(3).unwrap()), )), ), ( "tag2", Statistics::String(StatValues::new_with_distinct( Some("v1".to_string()), Some("v4".to_string()), 22, Some(6), Some(NonZeroU64::new(4).unwrap()), )), ), ( "tag3", Statistics::String(StatValues::new_with_distinct( Some("v1".to_string()), Some("v2".to_string()), 22, Some(1), Some(NonZeroU64::new(3).unwrap()), )), ), ( "time", Statistics::I64(StatValues::new(Some(0), Some(16), 22, Some(0))), ), ( "u64", Statistics::U64(StatValues::new(Some(5), Some(23), 22, Some(20))), ), ]; assert_batches_eq!(expected_data, &[batch.to_arrow(Projection::All).unwrap()]); assert_eq!(stats, expected_stats); let mut expected_timestamps = TimestampSummary::default(); for t in [ 7, 5, 7, 3, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ] { expected_timestamps.record_nanos(t) } let timestamps = batch.timestamp_summary().unwrap(); assert_eq!(timestamps, expected_timestamps); }
extern crate num_bigint; extern crate num_traits; extern crate hex; extern crate rand; use num_bigint::{BigUint}; use num_bigint::*; use num_traits::*; use num_bigint::Sign::*; fn main() { let mut rng = rand::thread_rng(); let p_buff = "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"; let mut p_buff_u8 = Vec::new(); for i in 0..p_buff.len(){ p_buff_u8.push(u8::from_str_radix(&p_buff[i..i+1],16).unwrap()); } let p = BigInt::from_radix_be(Plus,&p_buff_u8,16).unwrap(); let g = BigInt::from(2 as u32); let mut a = BigInt::one(); let mut b = BigInt::one(); let mut A = BigInt::one(); let mut B = BigInt::one(); while A == BigInt::one() || B == BigInt::one() { a = rng.gen_bigint(1000); // rand b = rng.gen_bigint(1000); A = modexp(&g, &a, &p); B = modexp(&g, &b, &p); } println!("A: {}",A); println!("B: {}",B); let s1 = modexp(&p,&b,&p); let s2 = modexp(&p,&a,&p); //let d = BigInt::from(12 as u32); //let t = BigInt::from(4 as u32); //let y = BigInt::from(21 as u32); println!("s1: {}",s1); println!("s2: {}",s2); } fn modexp(b: &BigInt, e: &BigInt, m: &BigInt) -> BigInt{ let mut b = b.clone(); let mut e = e.clone(); let mut res = BigInt::one(); let two = 2.to_bigint().unwrap(); while e > BigInt::zero() { if e.clone() % two.clone() == BigInt::one() { res = (res.clone() * b.clone()) % m.clone(); } b = (b.clone() * b.clone()) % m.clone(); e = e.clone() / two.clone(); } res % m }
//! # Chapter 7: Integrating the Parser //! //! So far, we've highlighted how to incrementally parse, but how do we bring this all together //! into our application? //! //! Parsers we've been working with look like: //! ```rust //! # use winnow::error::ContextError; //! # use winnow::error::ErrMode; //! # use winnow::Parser; //! # //! pub fn parser<'s>(input: &mut &'s str) -> PResult<&'s str> { //! // ... //! # Ok("") //! } //! //! type PResult<O> = Result< //! O, //! ErrMode<ContextError> //! >; //! ``` //! 1. We have to decide what to do about the "remainder" of the `input`. //! 2. The [`ErrMode<ContextError>`] is not compatible with the rest of the Rust ecosystem. //! Normally, Rust applications want errors that are `std::error::Error + Send + Sync + 'static` //! meaning: //! - They implement the [`std::error::Error`] trait //! - They can be sent across threads //! - They are safe to be referenced across threads //! - They do not borrow //! //! winnow provides [`Parser::parse`] to help with this: //! - Ensures we hit [`eof`] //! - Removes the [`ErrMode`] wrapper //! - Wraps the error in [`ParseError`] //! - Provides access to the original [`input`][ParseError::input] with the //! [`offset`][ParseError::offset] of where it failed //! - Provides a default renderer (via [`std::fmt::Display`]) //! ```rust //! # use winnow::prelude::*; //! # use winnow::token::take_while; //! # use winnow::combinator::dispatch; //! # use winnow::token::take; //! # use winnow::combinator::fail; //! use winnow::Parser; //! //! #[derive(Debug, PartialEq, Eq)] //! pub struct Hex(usize); //! //! impl std::str::FromStr for Hex { //! type Err = String; //! //! fn from_str(input: &str) -> Result<Self, Self::Err> { //! parse_digits //! .map(Hex) //! .parse(input) //! .map_err(|e| e.to_string()) //! } //! } //! //! // ... //! # fn parse_digits<'s>(input: &mut &'s str) -> PResult<usize> { //! # dispatch!(take(2usize); //! # "0b" => parse_bin_digits.try_map(|s| usize::from_str_radix(s, 2)), //! # "0o" => parse_oct_digits.try_map(|s| usize::from_str_radix(s, 8)), //! # "0d" => parse_dec_digits.try_map(|s| usize::from_str_radix(s, 10)), //! # "0x" => parse_hex_digits.try_map(|s| usize::from_str_radix(s, 16)), //! # _ => fail, //! # ).parse_next(input) //! # } //! # //! # fn parse_bin_digits<'s>(input: &mut &'s str) -> PResult<&'s str> { //! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits<'s>(input: &mut &'s str) -> PResult<&'s str> { //! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits<'s>(input: &mut &'s str) -> PResult<&'s str> { //! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits<'s>(input: &mut &'s str) -> PResult<&'s str> { //! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), //! # )).parse_next(input) //! # } //! //! fn main() { //! let input = "0x1a2b"; //! assert_eq!(input.parse::<Hex>().unwrap(), Hex(0x1a2b)); //! //! let input = "0x1a2b Hello"; //! assert!(input.parse::<Hex>().is_err()); //! let input = "ghiHello"; //! assert!(input.parse::<Hex>().is_err()); //! } //! ``` #![allow(unused_imports)] use super::chapter_1; use crate::combinator::eof; use crate::error::ErrMode; use crate::error::InputError; use crate::error::ParseError; use crate::PResult; use crate::Parser; pub use super::chapter_6 as previous; pub use crate::_tutorial as table_of_content;
pub mod tcp; mod tests; pub mod udp; pub struct Range { pub min: u16, pub max: u16, } type Port = u16; impl Default for Range { fn default() -> Self { Range { min: 1024, max: 65535, } } } /// A trait for defining behaviour on the lib's functions pub trait Ops { /// Returns any port in default range. /// /// # Arguments ///* `host` - a string slice pointing to the hostname to test the port availability on. /// /// # Examples ///``` ///use get_port::tcp::TcpPort; ///use get_port::udp::UdpPort; ///use get_port::Ops; /// ///let tcp_port = TcpPort::any("127.0.0.1").unwrap(); ///let udp_port = UdpPort::any("127.0.0.1").unwrap(); /// ``` fn any(host: &str) -> Option<Port>; /// Returns any port in given range. /// /// # Arguments /// * `host` - a string slice pointing to the hostname to test the port availability on. /// * `r` - the Range to choose a port from. /// /// # Examples /// ``` /// use get_port::tcp::TcpPort; /// use get_port::{Ops, Range}; /// use get_port::udp::UdpPort; /// /// let tcp_port = TcpPort::in_range("127.0.0.1", Range {min: 6000, max: 7000 }).unwrap(); /// let udp_port = UdpPort::in_range("127.0.0.1", Range {min: 8000, max: 9000 }).unwrap(); /// ``` fn in_range(host: &str, r: Range) -> Option<Port>; /// Returns any port from the supplied list. /// /// # Arguments /// * `host` - a string slice pointing to the hostname to test the port availability on. /// * `v` - a vector of Ports (`u16`) to choose from. /// /// # Examples /// ``` /// use get_port::tcp::TcpPort; /// use get_port::Ops; /// use get_port::udp::UdpPort; /// /// let tcp_port = TcpPort::from_list("127.0.0.1", vec![5000, 6000]).unwrap(); /// let udp_port = UdpPort::from_list("127.0.0.1", vec![5000, 6000]).unwrap(); /// ``` fn from_list(host: &str, v: Vec<Port>) -> Option<Port>; /// Returns any port from the default range except for the ones in the supplied list. /// /// # Arguments /// * `host` - a string slice pointing to the hostname to test the port availability on. /// * `v` - a vector of Ports (`u16`) to exclude. /// /// # Examples /// ``` /// use get_port::tcp::TcpPort; /// use get_port::Ops; /// use get_port::udp::UdpPort; /// /// let tcp_port = TcpPort::except("127.0.0.1", vec![1456, 6541]).unwrap(); /// let udp_port = UdpPort::except("127.0.0.1", vec![1456, 6541]).unwrap(); /// ``` fn except(host: &str, v: Vec<Port>) -> Option<Port>; /// Returns any port from the supplied range except for the ones in the supplied list. /// /// # Arguments /// * `host` - a string slice pointing to the hostname to test the port availability on. /// * `r` - the Range to choose a port from. /// * `v` - a vector of Ports (`u16`) to exclude. /// /// # Examples /// ``` /// use get_port::tcp::TcpPort; /// use get_port::{Ops, Range}; /// use get_port::udp::UdpPort; /// /// let tcp_port = TcpPort::in_range_except("127.0.0.1", Range { min: 6000, max: 7000 }, vec![6500]).unwrap(); /// let udp_port = UdpPort::in_range_except("127.0.0.1", Range { min: 6000, max: 7000 }, vec![6500]).unwrap(); /// ``` fn in_range_except(host: &str, r: Range, v: Vec<Port>) -> Option<Port>; /// Utility function to check whether a port is available or not. fn is_port_available(host: &str, p: Port) -> bool; }
use color_eyre::eyre::Result; use dotenv::dotenv; use structopt::StructOpt; mod day; mod init; mod run; use init::Init; use run::Run; #[derive(StructOpt)] #[structopt(name = "Advent Of Code")] enum Args { /// Download input file for given day Init(Init), /// Run code of the given day Run(Run), } fn main() -> Result<()> { color_eyre::install()?; dotenv()?; let args = Args::from_args(); match args { Args::Init(init) => init.initialize()?, Args::Run(run) => { let output = run.run()?; println!("{}", output) } } Ok(()) }
extern crate afs_util; use std::fs::File; use std::io::{BufReader, BufWriter}; use std::path::PathBuf; use std::env; use afs_util::AfsWriter; struct FileGetter { path: PathBuf, total_files: usize, idx: usize, } impl FileGetter { fn new<P>(into_path: P) -> FileGetter where P: Into<PathBuf> { let path = into_path.into(); let mut file_count = 0; loop { let filename = format!("{}.adx", file_count); if !path.join(filename).exists() { break; } file_count += 1; } FileGetter { path: path, total_files: file_count, idx: 0, } } } impl Iterator for FileGetter { type Item = BufReader<File>; fn next(&mut self) -> Option<Self::Item> { if self.idx == self.total_files { None } else { println!("Packing file {} out of {}", self.idx + 1, self.total_files); let filename = format!("{}.adx", self.idx); self.idx += 1; File::open(self.path.join(filename)) .ok() .map(|f| BufReader::new(f)) } } fn size_hint(&self) -> (usize, Option<usize>) { (self.total_files, Some(self.total_files)) } } impl ExactSizeIterator for FileGetter {} fn main() { let mut args = env::args().skip(1); let folder_name = args.next().unwrap(); let output_name = args.next().unwrap(); let output_file = BufWriter::new(File::create(output_name).unwrap()); let file_getter = FileGetter::new(folder_name); let afs_writer = AfsWriter::new(output_file, file_getter); afs_writer.write().unwrap(); }
// Copyright 2021 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::sync::Arc; use common_catalog::table::Table; use common_catalog::table_context::TableContext; use common_exception::Result; use common_expression::types::StringType; use common_expression::utils::FromData; use common_expression::DataBlock; use common_expression::TableDataType; use common_expression::TableField; use common_expression::TableSchemaRefExt; use common_meta_app::schema::TableIdent; use common_meta_app::schema::TableInfo; use common_meta_app::schema::TableMeta; use common_users::UserApiProvider; use crate::table::AsyncOneBlockSystemTable; use crate::table::AsyncSystemTable; pub struct UsersTable { table_info: TableInfo, } #[async_trait::async_trait] impl AsyncSystemTable for UsersTable { const NAME: &'static str = "system.users"; fn get_table_info(&self) -> &TableInfo { &self.table_info } async fn get_full_data(&self, ctx: Arc<dyn TableContext>) -> Result<DataBlock> { let tenant = ctx.get_tenant(); let users = UserApiProvider::instance().get_users(&tenant).await?; let names: Vec<Vec<u8>> = users.iter().map(|x| x.name.as_bytes().to_vec()).collect(); let hostnames: Vec<Vec<u8>> = users .iter() .map(|x| x.hostname.as_bytes().to_vec()) .collect(); let auth_types: Vec<Vec<u8>> = users .iter() .map(|x| x.auth_info.get_type().to_str().as_bytes().to_vec()) .collect(); let auth_strings: Vec<Vec<u8>> = users .iter() .map(|x| x.auth_info.get_auth_string().as_bytes().to_vec()) .collect(); let default_roles: Vec<Vec<u8>> = users .iter() .map(|x| { x.option .default_role() .cloned() .unwrap_or_default() .as_bytes() .to_vec() }) .collect(); Ok(DataBlock::new_from_columns(vec![ StringType::from_data(names), StringType::from_data(hostnames), StringType::from_data(auth_types), StringType::from_data(auth_strings), StringType::from_data(default_roles), ])) } } impl UsersTable { pub fn create(table_id: u64) -> Arc<dyn Table> { let schema = TableSchemaRefExt::create(vec![ TableField::new("name", TableDataType::String), TableField::new("hostname", TableDataType::String), TableField::new("auth_type", TableDataType::String), TableField::new("auth_string", TableDataType::String), TableField::new("default_role", TableDataType::String), ]); let table_info = TableInfo { desc: "'system'.'users'".to_string(), name: "users".to_string(), ident: TableIdent::new(table_id, 0), meta: TableMeta { schema, engine: "SystemUsers".to_string(), ..Default::default() }, ..Default::default() }; AsyncOneBlockSystemTable::create(UsersTable { table_info }) } }
extern crate logged_fu_skater; #[cfg(feature = "default-implementations")] use logged_fu_skater::Obfuscateable; #[test] fn test_default_implementation() { for test in TEST_CASES { let result = test.input.obfp(test.padding); assert_eq!(&result, test.expected_result, "input: {},\npadding: {}",test.input, test.padding) } } struct TestData { input: &'static str, padding: u8, expected_result: &'static str } const TEST_CASES: &[TestData] = &[ // Empty input TestData { input: "", padding: 0, expected_result: "AbsentmindedlyMuscularChildhood", }, // Test padding, positive and negative cases. Also, same input -> same output regardless of padding size. TestData { input: "asdf", padding: 0, expected_result: "HonestlyErgonomicSloth", }, TestData { input: "asdf", padding: 2, expected_result: "HonestlyErgonomicSloth5012", }, TestData { input: "asdf", padding: 4, expected_result: "HonestlyErgonomicSloth5012F6C6", }, TestData { input: "asdf", padding: 8, expected_result: "HonestlyErgonomicSloth5012F6C60B27661C", }, // Test a few unique UUID:s TestData { input: "ac968750-7ca2-4dde-908b-aacbbed2f470", padding: 1, expected_result: "VerticallyInterestingCarF4", }, TestData { input: "3e3278cd-6030-400d-9c0d-ef9be0119853", padding: 5, expected_result: "StillBlueGorillaA2DEC84AEE", }, TestData { input: "6745dc33-2fbd-4311-8884-10aab93199a9", padding: 7, expected_result: "AmazinglyBraindeadTalent7F2343BF6927EA", }, // Big data blob TestData { input: "mc093284750932nv2ono2hvfnoh3fo9ch3fxh23omhf293u4hfcqoiuwnhfc093u4hfc2938hnfc209u3hfc092hu3fc092nu3hfc92u3h4fc92nu3h4nfc923h40fc92h340fu2h34fc9u2nh3409uh2304hufc2093u4hfc0\nfcn9n2j43fc 9hu23cfj32fc2\nfc234ufh2o3ihfoh4f92c3hnfc928h43c92mj3fc23\ncfhfcliuw hfroiwuehgoiwuregoiwuecpowi hcpoqiwjecpoiqwhecp9824r+9u3h4f9283 h4f8w73hfwo83fou3wh4fcpoqihfp2u3h4fc983h4fcpu3nh4fcpoh3pf2h34pfc8h3p48hcqp348hfcqp384hfcpq834nfcpq9834hfcpq3h4fc", padding: 0, expected_result: "BestSadTalent", }, ];
#![allow(dead_code)] use crate::register_def::*; use crate::CPUOpFn; use crate::Memory; use crate::VMState; pub fn make_cpu_op_add(left_src: usize, right_src: usize, dst: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { vm_state.cpu.regs[dst] = vm_state.cpu.regs[left_src] + vm_state.cpu.regs[right_src]; vm_state.cpu.regs[REG_INSTR_PTR] += 4; Ok(()) }) } pub fn make_cpu_op_sub(left_src: usize, right_src: usize, dst: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { vm_state.cpu.regs[dst] = vm_state.cpu.regs[left_src] - vm_state.cpu.regs[right_src]; vm_state.cpu.regs[REG_INSTR_PTR] += 4; Ok(()) }) } pub fn make_cpu_op_div(left_src: usize, right_src: usize, dst: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { vm_state.cpu.regs[dst] = vm_state.cpu.regs[left_src] / vm_state.cpu.regs[right_src]; vm_state.cpu.regs[REG_INSTR_PTR] += 4; Ok(()) }) } pub fn make_cpu_op_mul(left_src: usize, right_src: usize, dst: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { vm_state.cpu.regs[dst] = vm_state.cpu.regs[left_src] * vm_state.cpu.regs[right_src]; vm_state.cpu.regs[REG_INSTR_PTR] += 4; Ok(()) }) } pub fn make_cpu_op_less(left_src: usize, right_src: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { vm_state.cpu.cmp_flag = vm_state.cpu.regs[left_src] < vm_state.cpu.regs[right_src]; vm_state.cpu.regs[REG_INSTR_PTR] += 3; Ok(()) }) } fn store_64(mem: &mut Memory, dst_mem: usize, val: u64) { mem.set(dst_mem as usize, (val & 0xFF) as u8); mem.set(dst_mem as usize + 1, ((val >> 8) & 0xFF) as u8); mem.set(dst_mem as usize + 2, ((val >> 16) & 0xFF) as u8); mem.set(dst_mem as usize + 3, ((val >> 24) & 0xFF) as u8); mem.set(dst_mem as usize + 4, ((val >> 32) & 0xFF) as u8); mem.set(dst_mem as usize + 5, ((val >> 40) & 0xFF) as u8); mem.set(dst_mem as usize + 6, ((val >> 48) & 0xFF) as u8); mem.set(dst_mem as usize + 7, ((val >> 56) & 0xFF) as u8); } fn load_64(mem: &Memory, src_mem: usize) -> u64 { let mut val = mem.get(src_mem as usize) as u64; val |= (mem.get(src_mem as usize + 1) as u64) << 8; val |= (mem.get(src_mem as usize + 2) as u64) << 16; val |= (mem.get(src_mem as usize + 3) as u64) << 24; val |= (mem.get(src_mem as usize + 4) as u64) << 32; val |= (mem.get(src_mem as usize + 5) as u64) << 40; val |= (mem.get(src_mem as usize + 6) as u64) << 48; val |= (mem.get(src_mem as usize + 7) as u64) << 56; val } pub fn make_cpu_op_store_64(src_reg: usize, dst_mem_reg: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { let mem_base = vm_state.cpu.regs[dst_mem_reg] as usize; store_64(&mut vm_state.mem, mem_base, vm_state.cpu.regs[src_reg]); vm_state.cpu.regs[REG_INSTR_PTR] += 3; Ok(()) }) } pub fn make_cpu_op_store_8(src_reg: usize, dst_mem_reg: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { let mem_base = vm_state.cpu.regs[dst_mem_reg] as usize; vm_state .mem .set(mem_base, (vm_state.cpu.regs[src_reg] & 0xFF) as u8); vm_state.cpu.regs[REG_INSTR_PTR] += 3; Ok(()) }) } pub fn make_cpu_op_load_8(src_mem_reg: usize, dst_reg: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { let mem_base = vm_state.cpu.regs[src_mem_reg] as usize; vm_state.cpu.regs[dst_reg] = vm_state.mem.get(mem_base) as u64; vm_state.cpu.regs[REG_INSTR_PTR] += 3; Ok(()) }) } pub fn make_cpu_op_load_64(src_mem_reg: usize, dst_reg: usize) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { let mem_base = vm_state.cpu.regs[src_mem_reg] as usize; vm_state.cpu.regs[dst_reg] = load_64(&vm_state.mem, mem_base); vm_state.cpu.regs[REG_INSTR_PTR] += 3; Ok(()) }) } pub fn make_cpu_op_halt() -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { vm_state.stop_execution = true; Ok(()) }) } pub fn make_cpu_op_jmp(dst_mem: u64) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { vm_state.cpu.regs[REG_INSTR_PTR] = dst_mem; Ok(()) }) } pub fn make_cpu_op_cond_jmp(dst_mem: u64) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { if vm_state.cpu.cmp_flag { vm_state.cpu.regs[REG_INSTR_PTR] = dst_mem; } else { vm_state.cpu.regs[REG_INSTR_PTR] += 2; } Ok(()) }) } pub fn make_cpu_op_push_state_to_stack() -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { let dst = vm_state.cpu.regs[REG_STACK_PTR] as usize; let mut current_mem_addr = dst; //save registers for reg in &vm_state.cpu.regs { store_64(&mut vm_state.mem, current_mem_addr, *reg); current_mem_addr += 8; } //save cmp result if vm_state.cpu.cmp_flag { vm_state.mem.set(current_mem_addr, 1); } else { vm_state.mem.set(current_mem_addr, 0); } current_mem_addr += 1; vm_state.cpu.regs[REG_STACK_PTR] = current_mem_addr as u64; Ok(()) }) } pub fn make_cpu_op_load_state_from_stack() -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { let dst = vm_state.cpu.regs[REG_STACK_PTR] as usize; let mut current_mem_addr = dst; //load registers for idx in 0..vm_state.cpu.regs.len() { vm_state.cpu.regs[idx] = load_64(&mut vm_state.mem, current_mem_addr); current_mem_addr += 8; } //load cmp result vm_state.cpu.cmp_flag = vm_state.mem.get(current_mem_addr) != 0; Ok(()) }) } pub fn make_cpu_op_load_immediate(dst_reg: usize, value: u64) -> Box<CPUOpFn> { Box::new(move |vm_state: &mut VMState| { vm_state.cpu.regs[dst_reg] = value; vm_state.cpu.regs[REG_INSTR_PTR] += 3; Ok(()) }) }
use crate::Result; use std::{ io::Read, process::{Child, Output}, sync::mpsc, }; pub fn stdout_and_stderr(out: Output) -> String { let out = if !out.stdout.is_empty() { out.stdout } else { out.stderr }; String::from_utf8(out).unwrap_or_default() } pub trait ProcessUtils { fn interactive_output(self, function: Option<fn(&mut Child) -> Result<()>>) -> Result<Output>; } impl ProcessUtils for Child { fn interactive_output( mut self, function: Option<fn(&mut Child) -> Result<()>>, ) -> Result<Output> { let mut stdout = self.stdout.take().expect("stdout is piped"); let mut stderr = self.stderr.take().expect("stderr is piped"); let (tx_out, rx) = mpsc::channel(); let tx_err = tx_out.clone(); enum OutType { Stdout(Vec<u8>), Stderr(Vec<u8>), } std::thread::spawn(move || { let mut out = Vec::new(); let _ = stdout.read_to_end(&mut out); let _ = tx_out.send(OutType::Stdout(out)); }); std::thread::spawn(move || { let mut err = Vec::new(); let _ = stderr.read_to_end(&mut err); let _ = tx_err.send(OutType::Stderr(err)); }); while self.try_wait()?.is_none() { if let Some(ref function) = function { function(&mut self)?; } } let mut stdout = None; let mut stderr = None; for _ in 0..2 { match rx.recv()? { OutType::Stdout(out) => stdout = Some(out), OutType::Stderr(err) => stderr = Some(err), } } Ok(Output { status: self.wait()?, stdout: stdout.unwrap(), stderr: stderr.unwrap(), }) } } pub fn _is_allowed_in_lib(s: &str) -> bool { match s.split_whitespace().collect::<Vec<_>>().as_slice() { // async fn|const fn|unsafe fn [_, "fn", ..] | ["fn", ..] | [_, "use", ..] | ["use", ..] | ["enum", ..] | ["struct", ..] | ["trait", ..] | ["impl", ..] | ["pub", ..] | ["extern", ..] | ["macro", ..] => true, ["macro_rules!", ..] => true, // attribute exp: // #[derive(Debug)] // struct B{} [tag, ..] if tag.starts_with('#') => true, _ => false, } } pub fn _remove_semi_col_if_exists(mut s: String) -> String { if !s.ends_with(';') { return s; } s.pop(); s } pub fn _is_use_stmt(l: &str) -> bool { let l = l.trim_start(); l.starts_with("use") || l.starts_with("#[allow(unused_imports)]use") }
extern crate bootstrap_rs as bootstrap; extern crate polygon; use bootstrap::window::*; use polygon::*; fn main() { // Open a window and create the renderer instance. let mut window = Window::new("Hello, Triangle!").unwrap(); let mut renderer = RendererBuilder::new(&window).build(); 'outer: loop { while let Some(message) = window.next_message() { if let Message::Close = message { break 'outer; } } // Render our empty scene. renderer.draw(); } }
use crate::lock::{ MapImmutable, PyImmutableMappedMutexGuard, PyMappedMutexGuard, PyMappedRwLockReadGuard, PyMappedRwLockWriteGuard, PyMutexGuard, PyRwLockReadGuard, PyRwLockWriteGuard, }; use std::{ fmt, ops::{Deref, DerefMut}, }; macro_rules! impl_from { ($lt:lifetime, $gen:ident, $t:ty, $($var:ident($from:ty),)*) => { $( impl<$lt, $gen: ?Sized> From<$from> for $t { fn from(t: $from) -> Self { Self::$var(t) } } )* }; } #[derive(Debug)] pub enum BorrowedValue<'a, T: ?Sized> { Ref(&'a T), MuLock(PyMutexGuard<'a, T>), MappedMuLock(PyImmutableMappedMutexGuard<'a, T>), ReadLock(PyRwLockReadGuard<'a, T>), MappedReadLock(PyMappedRwLockReadGuard<'a, T>), } impl_from!('a, T, BorrowedValue<'a, T>, Ref(&'a T), MuLock(PyMutexGuard<'a, T>), MappedMuLock(PyImmutableMappedMutexGuard<'a, T>), ReadLock(PyRwLockReadGuard<'a, T>), MappedReadLock(PyMappedRwLockReadGuard<'a, T>), ); impl<'a, T: ?Sized> BorrowedValue<'a, T> { pub fn map<U: ?Sized, F>(s: Self, f: F) -> BorrowedValue<'a, U> where F: FnOnce(&T) -> &U, { match s { Self::Ref(r) => BorrowedValue::Ref(f(r)), Self::MuLock(m) => BorrowedValue::MappedMuLock(PyMutexGuard::map_immutable(m, f)), Self::MappedMuLock(m) => { BorrowedValue::MappedMuLock(PyImmutableMappedMutexGuard::map(m, f)) } Self::ReadLock(r) => BorrowedValue::MappedReadLock(PyRwLockReadGuard::map(r, f)), Self::MappedReadLock(m) => { BorrowedValue::MappedReadLock(PyMappedRwLockReadGuard::map(m, f)) } } } } impl<T: ?Sized> Deref for BorrowedValue<'_, T> { type Target = T; fn deref(&self) -> &T { match self { Self::Ref(r) => r, Self::MuLock(m) => m, Self::MappedMuLock(m) => m, Self::ReadLock(r) => r, Self::MappedReadLock(m) => m, } } } impl fmt::Display for BorrowedValue<'_, str> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(self.deref(), f) } } #[derive(Debug)] pub enum BorrowedValueMut<'a, T: ?Sized> { RefMut(&'a mut T), MuLock(PyMutexGuard<'a, T>), MappedMuLock(PyMappedMutexGuard<'a, T>), WriteLock(PyRwLockWriteGuard<'a, T>), MappedWriteLock(PyMappedRwLockWriteGuard<'a, T>), } impl_from!('a, T, BorrowedValueMut<'a, T>, RefMut(&'a mut T), MuLock(PyMutexGuard<'a, T>), MappedMuLock(PyMappedMutexGuard<'a, T>), WriteLock(PyRwLockWriteGuard<'a, T>), MappedWriteLock(PyMappedRwLockWriteGuard<'a, T>), ); impl<'a, T: ?Sized> BorrowedValueMut<'a, T> { pub fn map<U: ?Sized, F>(s: Self, f: F) -> BorrowedValueMut<'a, U> where F: FnOnce(&mut T) -> &mut U, { match s { Self::RefMut(r) => BorrowedValueMut::RefMut(f(r)), Self::MuLock(m) => BorrowedValueMut::MappedMuLock(PyMutexGuard::map(m, f)), Self::MappedMuLock(m) => BorrowedValueMut::MappedMuLock(PyMappedMutexGuard::map(m, f)), Self::WriteLock(r) => BorrowedValueMut::MappedWriteLock(PyRwLockWriteGuard::map(r, f)), Self::MappedWriteLock(m) => { BorrowedValueMut::MappedWriteLock(PyMappedRwLockWriteGuard::map(m, f)) } } } } impl<T: ?Sized> Deref for BorrowedValueMut<'_, T> { type Target = T; fn deref(&self) -> &T { match self { Self::RefMut(r) => r, Self::MuLock(m) => m, Self::MappedMuLock(m) => m, Self::WriteLock(w) => w, Self::MappedWriteLock(w) => w, } } } impl<T: ?Sized> DerefMut for BorrowedValueMut<'_, T> { fn deref_mut(&mut self) -> &mut T { match self { Self::RefMut(r) => r, Self::MuLock(m) => &mut *m, Self::MappedMuLock(m) => &mut *m, Self::WriteLock(w) => &mut *w, Self::MappedWriteLock(w) => &mut *w, } } }
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::GString; use glib::StaticType; use glib::Value; use glib_sys; use gobject_sys; use libc; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; use std::ptr; use webkit2_webextension_sys; use DOMElement; use DOMEventTarget; use DOMHTMLCollection; use DOMNode; use DOMObject; glib_wrapper! { pub struct DOMHTMLElement(Object<webkit2_webextension_sys::WebKitDOMHTMLElement, webkit2_webextension_sys::WebKitDOMHTMLElementClass, DOMHTMLElementClass>) @extends DOMElement, DOMNode, DOMObject, @implements DOMEventTarget; match fn { get_type => || webkit2_webextension_sys::webkit_dom_html_element_get_type(), } } pub const NONE_DOMHTML_ELEMENT: Option<&DOMHTMLElement> = None; pub trait DOMHTMLElementExt: 'static { #[cfg_attr(feature = "v2_22", deprecated)] fn click(&self); #[cfg_attr(feature = "v2_22", deprecated)] fn get_access_key(&self) -> Option<GString>; #[cfg_attr(feature = "v2_10", deprecated)] #[cfg(any(not(feature = "v2_10"), feature = "dox"))] fn get_children(&self) -> Option<DOMHTMLCollection>; #[cfg_attr(feature = "v2_22", deprecated)] fn get_content_editable(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] fn get_dir(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_draggable(&self) -> bool; #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_hidden(&self) -> bool; #[cfg_attr(feature = "v2_8", deprecated)] #[cfg(any(not(feature = "v2_8"), feature = "dox"))] fn get_inner_html(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] fn get_inner_text(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] fn get_is_content_editable(&self) -> bool; #[cfg_attr(feature = "v2_22", deprecated)] fn get_lang(&self) -> Option<GString>; #[cfg_attr(feature = "v2_8", deprecated)] #[cfg(any(not(feature = "v2_8"), feature = "dox"))] fn get_outer_html(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] fn get_outer_text(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_spellcheck(&self) -> bool; #[cfg_attr(feature = "v2_22", deprecated)] fn get_tab_index(&self) -> libc::c_long; #[cfg_attr(feature = "v2_22", deprecated)] fn get_title(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_translate(&self) -> bool; #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_webkitdropzone(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] fn set_access_key(&self, value: &str); #[cfg_attr(feature = "v2_22", deprecated)] fn set_content_editable(&self, value: &str) -> Result<(), glib::Error>; #[cfg_attr(feature = "v2_22", deprecated)] fn set_dir(&self, value: &str); #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_draggable(&self, value: bool); #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_hidden(&self, value: bool); #[cfg_attr(feature = "v2_8", deprecated)] #[cfg(any(not(feature = "v2_8"), feature = "dox"))] fn set_inner_html(&self, contents: &str) -> Result<(), glib::Error>; #[cfg_attr(feature = "v2_22", deprecated)] fn set_inner_text(&self, value: &str) -> Result<(), glib::Error>; #[cfg_attr(feature = "v2_22", deprecated)] fn set_lang(&self, value: &str); #[cfg_attr(feature = "v2_8", deprecated)] #[cfg(any(not(feature = "v2_8"), feature = "dox"))] fn set_outer_html(&self, contents: &str) -> Result<(), glib::Error>; #[cfg_attr(feature = "v2_22", deprecated)] fn set_outer_text(&self, value: &str) -> Result<(), glib::Error>; #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_spellcheck(&self, value: bool); #[cfg_attr(feature = "v2_22", deprecated)] fn set_tab_index(&self, value: libc::c_long); #[cfg_attr(feature = "v2_22", deprecated)] fn set_title(&self, value: &str); #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_translate(&self, value: bool); #[cfg_attr(feature = "v2_22", deprecated)] #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_webkitdropzone(&self, value: &str); fn get_property_draggable(&self) -> bool; fn set_property_draggable(&self, draggable: bool); fn get_property_hidden(&self) -> bool; fn set_property_hidden(&self, hidden: bool); fn get_property_spellcheck(&self) -> bool; fn set_property_spellcheck(&self, spellcheck: bool); fn get_property_translate(&self) -> bool; fn set_property_translate(&self, translate: bool); fn get_property_webkitdropzone(&self) -> Option<GString>; fn set_property_webkitdropzone(&self, webkitdropzone: Option<&str>); fn connect_property_access_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_content_editable_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId; fn connect_property_dir_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_draggable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_inner_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_is_content_editable_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId; fn connect_property_lang_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_outer_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_spellcheck_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_tab_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_translate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_webkitdropzone_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId; } impl<O: IsA<DOMHTMLElement>> DOMHTMLElementExt for O { fn click(&self) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_click(self.as_ref().to_glib_none().0); } } fn get_access_key(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_element_get_access_key( self.as_ref().to_glib_none().0, ), ) } } #[cfg(any(not(feature = "v2_10"), feature = "dox"))] fn get_children(&self) -> Option<DOMHTMLCollection> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_element_get_children( self.as_ref().to_glib_none().0, ), ) } } fn get_content_editable(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_element_get_content_editable( self.as_ref().to_glib_none().0, ), ) } } fn get_dir(&self) -> Option<GString> { unsafe { from_glib_full(webkit2_webextension_sys::webkit_dom_html_element_get_dir( self.as_ref().to_glib_none().0, )) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_draggable(&self) -> bool { unsafe { from_glib( webkit2_webextension_sys::webkit_dom_html_element_get_draggable( self.as_ref().to_glib_none().0, ), ) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_hidden(&self) -> bool { unsafe { from_glib( webkit2_webextension_sys::webkit_dom_html_element_get_hidden( self.as_ref().to_glib_none().0, ), ) } } #[cfg(any(not(feature = "v2_8"), feature = "dox"))] fn get_inner_html(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_element_get_inner_html( self.as_ref().to_glib_none().0, ), ) } } fn get_inner_text(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_element_get_inner_text( self.as_ref().to_glib_none().0, ), ) } } fn get_is_content_editable(&self) -> bool { unsafe { from_glib( webkit2_webextension_sys::webkit_dom_html_element_get_is_content_editable( self.as_ref().to_glib_none().0, ), ) } } fn get_lang(&self) -> Option<GString> { unsafe { from_glib_full(webkit2_webextension_sys::webkit_dom_html_element_get_lang( self.as_ref().to_glib_none().0, )) } } #[cfg(any(not(feature = "v2_8"), feature = "dox"))] fn get_outer_html(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_element_get_outer_html( self.as_ref().to_glib_none().0, ), ) } } fn get_outer_text(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_element_get_outer_text( self.as_ref().to_glib_none().0, ), ) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_spellcheck(&self) -> bool { unsafe { from_glib( webkit2_webextension_sys::webkit_dom_html_element_get_spellcheck( self.as_ref().to_glib_none().0, ), ) } } fn get_tab_index(&self) -> libc::c_long { unsafe { webkit2_webextension_sys::webkit_dom_html_element_get_tab_index( self.as_ref().to_glib_none().0, ) } } fn get_title(&self) -> Option<GString> { unsafe { from_glib_full(webkit2_webextension_sys::webkit_dom_html_element_get_title( self.as_ref().to_glib_none().0, )) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_translate(&self) -> bool { unsafe { from_glib( webkit2_webextension_sys::webkit_dom_html_element_get_translate( self.as_ref().to_glib_none().0, ), ) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_webkitdropzone(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_element_get_webkitdropzone( self.as_ref().to_glib_none().0, ), ) } } fn set_access_key(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_access_key( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } fn set_content_editable(&self, value: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); let _ = webkit2_webextension_sys::webkit_dom_html_element_set_content_editable( self.as_ref().to_glib_none().0, value.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn set_dir(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_dir( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_draggable(&self, value: bool) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_draggable( self.as_ref().to_glib_none().0, value.to_glib(), ); } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_hidden(&self, value: bool) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_hidden( self.as_ref().to_glib_none().0, value.to_glib(), ); } } #[cfg(any(not(feature = "v2_8"), feature = "dox"))] fn set_inner_html(&self, contents: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); let _ = webkit2_webextension_sys::webkit_dom_html_element_set_inner_html( self.as_ref().to_glib_none().0, contents.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn set_inner_text(&self, value: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); let _ = webkit2_webextension_sys::webkit_dom_html_element_set_inner_text( self.as_ref().to_glib_none().0, value.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn set_lang(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_lang( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } #[cfg(any(not(feature = "v2_8"), feature = "dox"))] fn set_outer_html(&self, contents: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); let _ = webkit2_webextension_sys::webkit_dom_html_element_set_outer_html( self.as_ref().to_glib_none().0, contents.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn set_outer_text(&self, value: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); let _ = webkit2_webextension_sys::webkit_dom_html_element_set_outer_text( self.as_ref().to_glib_none().0, value.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_spellcheck(&self, value: bool) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_spellcheck( self.as_ref().to_glib_none().0, value.to_glib(), ); } } fn set_tab_index(&self, value: libc::c_long) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_tab_index( self.as_ref().to_glib_none().0, value, ); } } fn set_title(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_title( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_translate(&self, value: bool) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_translate( self.as_ref().to_glib_none().0, value.to_glib(), ); } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_webkitdropzone(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_element_set_webkitdropzone( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } fn get_property_draggable(&self) -> bool { unsafe { let mut value = Value::from_type(<bool as StaticType>::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"draggable\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `draggable` getter") .unwrap() } } fn set_property_draggable(&self, draggable: bool) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"draggable\0".as_ptr() as *const _, Value::from(&draggable).to_glib_none().0, ); } } fn get_property_hidden(&self) -> bool { unsafe { let mut value = Value::from_type(<bool as StaticType>::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"hidden\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `hidden` getter") .unwrap() } } fn set_property_hidden(&self, hidden: bool) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"hidden\0".as_ptr() as *const _, Value::from(&hidden).to_glib_none().0, ); } } fn get_property_spellcheck(&self) -> bool { unsafe { let mut value = Value::from_type(<bool as StaticType>::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"spellcheck\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `spellcheck` getter") .unwrap() } } fn set_property_spellcheck(&self, spellcheck: bool) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"spellcheck\0".as_ptr() as *const _, Value::from(&spellcheck).to_glib_none().0, ); } } fn get_property_translate(&self) -> bool { unsafe { let mut value = Value::from_type(<bool as StaticType>::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"translate\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `translate` getter") .unwrap() } } fn set_property_translate(&self, translate: bool) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"translate\0".as_ptr() as *const _, Value::from(&translate).to_glib_none().0, ); } } fn get_property_webkitdropzone(&self) -> Option<GString> { unsafe { let mut value = Value::from_type(<GString as StaticType>::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"webkitdropzone\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `webkitdropzone` getter") } } fn set_property_webkitdropzone(&self, webkitdropzone: Option<&str>) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"webkitdropzone\0".as_ptr() as *const _, Value::from(webkitdropzone).to_glib_none().0, ); } } fn connect_property_access_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_access_key_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::access-key\0".as_ptr() as *const _, Some(transmute(notify_access_key_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_content_editable_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_content_editable_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::content-editable\0".as_ptr() as *const _, Some(transmute( notify_content_editable_trampoline::<Self, F> as usize, )), Box_::into_raw(f), ) } } fn connect_property_dir_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_dir_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::dir\0".as_ptr() as *const _, Some(transmute(notify_dir_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_draggable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_draggable_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::draggable\0".as_ptr() as *const _, Some(transmute(notify_draggable_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_hidden_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::hidden\0".as_ptr() as *const _, Some(transmute(notify_hidden_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_inner_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_inner_text_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::inner-text\0".as_ptr() as *const _, Some(transmute(notify_inner_text_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_is_content_editable_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_is_content_editable_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-content-editable\0".as_ptr() as *const _, Some(transmute( notify_is_content_editable_trampoline::<Self, F> as usize, )), Box_::into_raw(f), ) } } fn connect_property_lang_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_lang_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::lang\0".as_ptr() as *const _, Some(transmute(notify_lang_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_outer_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_outer_text_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::outer-text\0".as_ptr() as *const _, Some(transmute(notify_outer_text_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_spellcheck_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_spellcheck_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::spellcheck\0".as_ptr() as *const _, Some(transmute(notify_spellcheck_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_tab_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tab_index_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tab-index\0".as_ptr() as *const _, Some(transmute(notify_tab_index_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(transmute(notify_title_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_translate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_translate_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::translate\0".as_ptr() as *const _, Some(transmute(notify_translate_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_webkitdropzone_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_webkitdropzone_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::webkitdropzone\0".as_ptr() as *const _, Some(transmute( notify_webkitdropzone_trampoline::<Self, F> as usize, )), Box_::into_raw(f), ) } } } impl fmt::Display for DOMHTMLElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "DOMHTMLElement") } }
use std::{ ffi::OsStr, time::{Duration, Instant}, }; use async_fuse::FileAttr; use menmos_client::{Meta, Type}; use crate::{constants, MenmosFS}; use super::{build_attributes, Error, Result}; pub struct LookupReply { pub ttl: Duration, pub attrs: FileAttr, pub generation: u64, } impl MenmosFS { async fn lookup_vdir(&self, key: &(u64, String)) -> Option<LookupReply> { if let Some(inode) = self.virtual_directories.get(key).await { log::info!("lookup on {:?} found vdir inode: {}", key.1, inode,); let attrs = build_attributes(inode, &Meta::new(&key.1, Type::Directory), 0o444); Some(LookupReply { ttl: constants::TTL, attrs, generation: inode, // TODO: Use a nanosecond timestamp here instead. }) } else { None } } async fn should_refresh(&self, parent_inode: u64) -> bool { if let Some(last_refresh) = self.inode_to_last_refresh.get(&parent_inode).await { Instant::now().duration_since(last_refresh) > Duration::from_secs(60) } else { true } } async fn refresh_parent_if_required(&self, parent_inode: u64) -> Result<()> { if self.should_refresh(parent_inode).await { self.readdir_impl(parent_inode, 0).await?; self.inode_to_last_refresh .insert(parent_inode, Instant::now()) .await; } Ok(()) } pub async fn lookup_impl(&self, parent_inode: u64, name: &OsStr) -> Result<LookupReply> { log::info!("lookup i{}/{:?}", parent_inode, name); let str_name = name.to_string_lossy().to_string(); // Before we do anything, we need to make sure the children of our parent directory were populated. // This is usually done by readdir when using this fuse mount with a file explorer, but in case someone kept a path or tries to directly access a file, we need to make sure everything is there. self.refresh_parent_if_required(parent_inode).await?; // First, check if it's a virtual directory. if let Some(resp) = self.lookup_vdir(&(parent_inode, str_name.clone())).await { return Ok(resp); } // If not, proceed as usual and lookup the blob. let blob_id = self .name_to_blobid .get(&(parent_inode, str_name.clone())) .await .ok_or(Error::NotFound)?; match self.client.get_meta(&blob_id).await { Ok(Some(blob_meta)) => { // We got the meta, time to make the item attribute. let inode = self.get_inode(&blob_id).await; let attributes = build_attributes(inode, &blob_meta, 0o764); log::info!( "lookup on {:?} found inode: {} for ID {} ({:?})", name, inode, blob_id, blob_meta.blob_type ); self.inode_to_blobid.insert(inode, blob_id).await; Ok(LookupReply { ttl: constants::TTL, attrs: attributes, generation: inode, // TODO: Use nanosecond timestamp. }) } Ok(None) => Err(Error::NotFound), Err(e) => { log::error!("lookup error: {}", e); Err(Error::IOError) } } } }
//! Policy framework for [backends](crate::backend::CacheBackend). use std::{ cell::RefCell, collections::{HashMap, VecDeque}, fmt::Debug, hash::Hash, marker::PhantomData, ops::Deref, sync::{Arc, Weak}, }; use iox_time::{Time, TimeProvider}; use parking_lot::{lock_api::ArcMutexGuard, Mutex, RawMutex, ReentrantMutex}; use super::CacheBackend; pub mod lru; pub mod refresh; pub mod remove_if; pub mod ttl; #[cfg(test)] mod integration_tests; /// Convenience macro to easily follow the borrow/lock chain of [`StrongSharedInner`]. /// /// This cannot just be a method because we cannot return references to local variables. macro_rules! lock_inner { ($guard:ident = $inner:expr) => { let $guard = $inner.lock(); let $guard = $guard.try_borrow_mut().expect("illegal recursive access"); }; (mut $guard:ident = $inner:expr) => { let $guard = $inner.lock(); let mut $guard = $guard.try_borrow_mut().expect("illegal recursive access"); }; } /// Backend that is controlled by different policies. /// /// # Policies & Recursion /// /// Policies have two tasks: /// /// - initiate changes (e.g. based on timers) /// - react to changes /// /// Getting data from a [`PolicyBackend`] and feeding data back into it in a somewhat synchronous /// manner sounds really close to recursion. Uncontrolled recursion however is bad for the /// following reasons: /// /// 1. **Stack space:** We may easily run out of stack space. /// 2. **Ownership:** Looping back into the same data structure can easily lead to deadlocks (data /// corruption is luckily prevented by Rust's ownership model). /// /// However sometimes we need to have interactions of policies in a "recursive" manner. E.g.: /// /// 1. A refresh policies updates a value based on a timer. The value gets bigger. /// 2. Some resource-pool policy decides that this is now too much data and wants to evict data. /// 3. The refresh policy gets informed about the values that are removed so it can stop refreshing /// them. /// /// The solution that [`PolicyBackend`] uses is the following: /// /// All interaction of the policy with a [`PolicyBackend`] happens through a proxy object called /// [`ChangeRequest`]. The [`ChangeRequest`] encapsulates a single atomic "transaction" on the /// underlying store. This can be a simple operation as [`REMOVE`](CacheBackend::remove) but also /// compound operations like "get+remove" (e.g. to check if a value needs to be pruned from the /// cache). The policy has two ways of issuing [`ChangeRequest`]s: /// /// 1. **Initial / self-driven:** Upon creation the policy receives a [`CallbackHandle`] that it /// can use initiate requests. This handle must only be used to create requests "out of thin /// air" (e.g. based on a timer). It MUST NOT be used to react to changes (see next point) to /// avoid deadlocks. /// 2. **Reactions:** Each policy implements a [`Subscriber`] that receives notifications for each /// changes. These notification return [`ChangeRequest`]s that the policy wishes to be /// performed. This construct is designed to avoid recursion. /// /// Also note that a policy that uses the subscriber interface MUST NOT hold locks on their /// internal data structure while performing _initial requests_ to avoid deadlocks (since the /// subscriber will be informed about the changes). /// /// We cannot guarantee that policies fulfill this interface, but [`PolicyBackend`] performs some /// sanity checks (e.g. it will catch if the same thread that started an initial requests recurses /// into another initial request). /// /// # Change Propagation /// /// Each [`ChangeRequest`] is processed atomically, so "get + set" / "compare + exchange" patterns /// work as expected. /// /// Changes will be propagated "breadth first". This means that the initial changes will form a /// task list. For every task in this list (front to back), we will execute the [`ChangeRequest`]. /// Every change that is performed within this request (usually only one) we propagate the change /// as follows: /// /// 1. underlying backend /// 2. policies (in the order they where added) /// /// From step 2 we collect new change requests that will be added to the back of the task list. /// /// The original requests will return to the caller once all tasks are completed. /// /// When a [`ChangeRequest`] performs multiple operations -- e.g. [`GET`](CacheBackend::get) and /// [`SET`](CacheBackend::set) -- we first inform all subscribers about the first operation (in /// this case: [`GET`](CacheBackend::get)) and collect the resulting [`ChangeRequest`]s. Then we /// process the second operation (in this case: [`SET`](CacheBackend::set)). /// /// # `GET` /// /// The return value for [`CacheBackend::get`] is fetched from the inner backend AFTER all changes /// are applied. /// /// Note [`ChangeRequest::get`] has no way of returning a result to the [`Subscriber`] that created /// it. The "changes" solely act as some kind of "keep alive" / "this was used" signal. /// /// # Example /// /// **The policies in these examples are deliberately silly but simple!** /// /// Let's start with a purely reactive policy that will round up all integer values to the next /// even number: /// /// ``` /// use std::{ /// collections::HashMap, /// sync::Arc, /// }; /// use cache_system::backend::{ /// CacheBackend, /// policy::{ /// ChangeRequest, /// PolicyBackend, /// Subscriber, /// }, /// }; /// use iox_time::{ /// SystemProvider, /// Time, /// }; /// /// #[derive(Debug)] /// struct EvenNumberPolicy; /// /// type CR = ChangeRequest<'static, &'static str, u64>; /// /// impl Subscriber for EvenNumberPolicy { /// type K = &'static str; /// type V = u64; /// /// fn set(&mut self, k: &&'static str, v: &u64, _now: Time) -> Vec<CR> { /// // When new key `k` is set to value `v` if `v` is odd, /// // request a change to set `k` to `v+1` /// if v % 2 == 1 { /// vec![CR::set(k, v + 1)] /// } else { /// vec![] /// } /// } /// } /// /// let mut backend = PolicyBackend::new( /// Box::new(HashMap::new()), /// Arc::new(SystemProvider::new()), /// ); /// backend.add_policy(|_callback_backend| EvenNumberPolicy); /// /// backend.set("foo", 8); /// backend.set("bar", 9); /// /// assert_eq!(backend.get(&"foo"), Some(8)); /// assert_eq!(backend.get(&"bar"), Some(10)); /// ``` /// /// And here is a more active backend that regularly writes the current system time to a key: /// /// ``` /// use std::{ /// collections::HashMap, /// sync::{ /// Arc, /// atomic::{AtomicBool, Ordering}, /// }, /// thread::{JoinHandle, sleep, spawn}, /// time::{Duration, Instant}, /// }; /// use cache_system::backend::{ /// CacheBackend, /// policy::{ /// ChangeRequest, /// PolicyBackend, /// Subscriber, /// }, /// }; /// use iox_time::SystemProvider; /// /// #[derive(Debug)] /// struct NowPolicy { /// cancel: Arc<AtomicBool>, /// join_handle: Option<JoinHandle<()>>, /// }; /// /// impl Drop for NowPolicy { /// fn drop(&mut self) { /// self.cancel.store(true, Ordering::SeqCst); /// self.join_handle /// .take() /// .expect("worker thread present") /// .join() /// .expect("worker thread finished"); /// } /// } /// /// type CR = ChangeRequest<'static, &'static str, Instant>; /// /// impl Subscriber for NowPolicy { /// type K = &'static str; /// type V = Instant; /// } /// /// let mut backend = PolicyBackend::new( /// Box::new(HashMap::new()), /// Arc::new(SystemProvider::new()), /// ); /// backend.add_policy(|mut callback_handle| { /// let cancel = Arc::new(AtomicBool::new(false)); /// let cancel_captured = Arc::clone(&cancel); /// let join_handle = spawn(move || { /// loop { /// if cancel_captured.load(Ordering::SeqCst) { /// break; /// } /// callback_handle.execute_requests(vec![ /// CR::set("now", Instant::now()), /// ]); /// sleep(Duration::from_millis(1)); /// } /// }); /// NowPolicy{cancel, join_handle: Some(join_handle)} /// }); /// /// /// // eventually we should see a key /// let t_start = Instant::now(); /// loop { /// if let Some(t) = backend.get(&"now") { /// // value should be fresh /// assert!(t.elapsed() < Duration::from_millis(100)); /// break; /// } /// /// assert!(t_start.elapsed() < Duration::from_secs(1)); /// sleep(Duration::from_millis(10)); /// } /// ``` #[derive(Debug)] pub struct PolicyBackend<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { inner: StrongSharedInner<K, V>, } impl<K, V> PolicyBackend<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { /// Create new backend w/o any policies. /// /// # Panic /// /// Panics if `inner` is not empty. pub fn new( inner: Box<dyn CacheBackend<K = K, V = V>>, time_provider: Arc<dyn TimeProvider>, ) -> Self { assert!(inner.is_empty(), "inner backend is not empty"); Self { inner: Arc::new(ReentrantMutex::new(RefCell::new(PolicyBackendInner { inner: Arc::new(Mutex::new(inner)), subscribers: Vec::new(), time_provider, }))), } } /// Create a new backend with a HashMap as the [`CacheBackend`]. pub fn hashmap_backed(time_provider: Arc<dyn TimeProvider>) -> Self { // See <https://github.com/rust-lang/rust-clippy/issues/9621>. This clippy lint suggests // replacing `Box::new(HashMap::new())` with `Box::default()`, which in most cases would be // shorter, but because this type is actually a `Box<dyn Trait>`, the replacement would // need to be `Box::<HashMap<_, _>>::default()`, which doesn't seem like an improvement. #[allow(clippy::box_default)] Self::new(Box::new(HashMap::new()), Arc::clone(&time_provider)) } /// Adds new policy. /// /// See documentation of [`PolicyBackend`] for more information. /// /// This is called with a function that receives the "callback backend" to this backend and /// should return a [`Subscriber`]. This loopy construct was chosen to discourage the leakage /// of the "callback backend" to any other object. pub fn add_policy<C, S>(&mut self, policy_constructor: C) where C: FnOnce(CallbackHandle<K, V>) -> S, S: Subscriber<K = K, V = V>, { let callback_handle = CallbackHandle { inner: Arc::downgrade(&self.inner), }; let subscriber = policy_constructor(callback_handle); lock_inner!(mut guard = self.inner); guard.subscribers.push(Box::new(subscriber)); } /// Provide temporary read-only access to the underlying backend. /// /// This is mostly useful for debugging and testing. pub fn inner_ref(&mut self) -> InnerBackendRef<'_, K, V> { // NOTE: We deliberately use a mutable reference here to prevent users from using `<Self as // CacheBackend>` while we hold a lock to the underlying backend. lock_inner!(guard = self.inner); InnerBackendRef { inner: guard.inner.lock_arc(), _phantom: PhantomData, } } } impl<K, V> CacheBackend for PolicyBackend<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { type K = K; type V = V; fn get(&mut self, k: &Self::K) -> Option<Self::V> { lock_inner!(mut guard = self.inner); perform_changes(&mut guard, vec![ChangeRequest::get(k.clone())]); // poll inner backend AFTER everything has settled let mut inner = guard.inner.lock(); inner.get(k) } fn set(&mut self, k: Self::K, v: Self::V) { lock_inner!(mut guard = self.inner); perform_changes(&mut guard, vec![ChangeRequest::set(k, v)]); } fn remove(&mut self, k: &Self::K) { lock_inner!(mut guard = self.inner); perform_changes(&mut guard, vec![ChangeRequest::remove(k.clone())]); } fn is_empty(&self) -> bool { lock_inner!(guard = self.inner); let inner = guard.inner.lock(); inner.is_empty() } fn as_any(&self) -> &dyn std::any::Any { self } } /// Handle that allows a [`Subscriber`] to send [`ChangeRequest`]s back to the [`PolicyBackend`] /// that owns that very [`Subscriber`]. #[derive(Debug)] pub struct CallbackHandle<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { inner: WeakSharedInner<K, V>, } impl<K, V> CallbackHandle<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { /// Start a series of requests to the [`PolicyBackend`] that is referenced by this handle. /// /// This method returns AFTER the requests and all the follow-up changes requested by all /// policies are played out. You should NOT hold a lock on your policies internal data /// structures while calling this function if you plan to also [subscribe](Subscriber) to /// changes because this would easily lead to deadlocks. pub fn execute_requests(&mut self, change_requests: Vec<ChangeRequest<'_, K, V>>) { let Some(inner) = self.inner.upgrade() else { // backend gone, can happen during shutdowns, try not to panic return; }; lock_inner!(mut guard = inner); perform_changes(&mut guard, change_requests); } } #[derive(Debug)] struct PolicyBackendInner<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { /// Underlying cache backend. /// /// This is wrapped into another `Arc<Mutex<...>>` construct even though [`PolicyBackendInner`] /// is already guarded by a lock because we need to reference the underlying backend from /// [`Recorder`], and [`Recorder`] implements [`CacheBackend`] which is `'static`. inner: Arc<Mutex<Box<dyn CacheBackend<K = K, V = V>>>>, /// List of subscribers. subscribers: Vec<Box<dyn Subscriber<K = K, V = V>>>, /// Time provider. time_provider: Arc<dyn TimeProvider>, } type WeakSharedInner<K, V> = Weak<ReentrantMutex<RefCell<PolicyBackendInner<K, V>>>>; type StrongSharedInner<K, V> = Arc<ReentrantMutex<RefCell<PolicyBackendInner<K, V>>>>; /// Perform changes breadth first. fn perform_changes<K, V>( inner: &mut PolicyBackendInner<K, V>, change_requests: Vec<ChangeRequest<'_, K, V>>, ) where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { let mut tasks = VecDeque::from(change_requests); let now = inner.time_provider.now(); while let Some(change_request) = tasks.pop_front() { let mut recorder = Recorder { inner: Arc::clone(&inner.inner), records: vec![], }; change_request.eval(&mut recorder); for record in recorder.records { for subscriber in &mut inner.subscribers { let requests = match &record { Record::Get { k } => subscriber.get(k, now), Record::Set { k, v } => subscriber.set(k, v, now), Record::Remove { k } => subscriber.remove(k, now), }; tasks.extend(requests.into_iter()); } } } } /// Subscriber to change events. pub trait Subscriber: Debug + Send + 'static { /// Cache key. type K: Clone + Eq + Hash + Ord + Debug + Send + 'static; /// Cached value. type V: Clone + Debug + Send + 'static; /// Get value for given key if it exists. /// /// The current time `now` is provided as a parameter so that all policies and backends use a /// unified timestamp rather than their own provider, which is more consistent and performant. fn get(&mut self, _k: &Self::K, _now: Time) -> Vec<ChangeRequest<'static, Self::K, Self::V>> { // do nothing by default vec![] } /// Set value for given key. /// /// It is OK to set and override a key that already exists. /// /// The current time `now` is provided as a parameter so that all policies and backends use a /// unified timestamp rather than their own provider, which is more consistent and performant. fn set( &mut self, _k: &Self::K, _v: &Self::V, _now: Time, ) -> Vec<ChangeRequest<'static, Self::K, Self::V>> { // do nothing by default vec![] } /// Remove value for given key. /// /// It is OK to remove a key even when it does not exist. /// /// The current time `now` is provided as a parameter so that all policies and backends use a /// unified timestamp rather than their own provider, which is more consistent and performant. fn remove( &mut self, _k: &Self::K, _now: Time, ) -> Vec<ChangeRequest<'static, Self::K, Self::V>> { // do nothing by default vec![] } } /// A change request to a backend. pub struct ChangeRequest<'a, K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { fun: ChangeRequestFn<'a, K, V>, } impl<'a, K, V> Debug for ChangeRequest<'a, K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("CacheRequest").finish_non_exhaustive() } } impl<'a, K, V> ChangeRequest<'a, K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { /// Custom way of constructing a change request. /// /// This is considered a rather low-level function and you should prefer the higher-level /// constructs like [`get`](Self::get), [`set`](Self::set), and [`remove`](Self::remove). /// /// Takes a "callback backend" and can freely act on it. The underlying backend of /// [`PolicyBackend`] is guaranteed to be locked during a single request, so "get + modify" /// patterns work out of the box without the need to fear interleaving modifications. pub fn from_fn<F>(f: F) -> Self where F: for<'b> FnOnce(&'b mut Recorder<K, V>) + 'a, { Self { fun: Box::new(f) } } /// [`GET`](CacheBackend::get) pub fn get(k: K) -> Self { Self::from_fn(move |backend| { backend.get(&k); }) } /// [`SET`](CacheBackend::set) pub fn set(k: K, v: V) -> Self { Self::from_fn(move |backend| { backend.set(k, v); }) } /// [`REMOVE`](CacheBackend::remove). pub fn remove(k: K) -> Self { Self::from_fn(move |backend| { backend.remove(&k); }) } /// Ensure that backend is empty and panic otherwise. /// /// This is mostly useful during initialization. pub fn ensure_empty() -> Self { Self::from_fn(|backend| { assert!(backend.is_empty(), "inner backend is not empty"); }) } /// Execute this change request. pub fn eval(self, backend: &mut Recorder<K, V>) { (self.fun)(backend) } } /// Function captured within [`ChangeRequest`]. type ChangeRequestFn<'a, K, V> = Box<dyn for<'b> FnOnce(&'b mut Recorder<K, V>) + 'a>; /// Records of interactions with the callback [`CacheBackend`]. #[derive(Debug, PartialEq)] enum Record<K, V> { /// [`GET`](CacheBackend::get) Get { /// Key. k: K, }, /// [`SET`](CacheBackend::set) Set { /// Key. k: K, /// Value. v: V, }, /// [`REMOVE`](CacheBackend::remove). Remove { /// Key. k: K, }, } /// Specialized [`CacheBackend`] that forwards changes and requests to the underlying backend of /// [`PolicyBackend`] but also records all changes into [`Record`]s. #[derive(Debug)] pub struct Recorder<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { inner: Arc<Mutex<Box<dyn CacheBackend<K = K, V = V>>>>, records: Vec<Record<K, V>>, } impl<K, V> Recorder<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { /// Perform a [`GET`](CacheBackend::get) request that is NOT seen by other policies. /// /// This is helpful if you just want to check the underlying data of a key without treating it /// as "used". /// /// Note that this functionality only exists for [`GET`](CacheBackend::get) requests, not for /// modifying requests like [`SET`](CacheBackend::set) or [`REMOVE`](CacheBackend::remove) /// since they always require policies to be in-sync. pub fn get_untracked(&mut self, k: &K) -> Option<V> { self.inner.lock().get(k) } } impl<K, V> CacheBackend for Recorder<K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { type K = K; type V = V; fn get(&mut self, k: &Self::K) -> Option<Self::V> { self.records.push(Record::Get { k: k.clone() }); self.inner.lock().get(k) } fn set(&mut self, k: Self::K, v: Self::V) { self.records.push(Record::Set { k: k.clone(), v: v.clone(), }); self.inner.lock().set(k, v); } fn remove(&mut self, k: &Self::K) { self.records.push(Record::Remove { k: k.clone() }); self.inner.lock().remove(k); } fn is_empty(&self) -> bool { self.inner.lock().is_empty() } fn as_any(&self) -> &dyn std::any::Any { self } } /// Read-only ref to the inner backend of [`PolicyBackend`] for debugging. pub struct InnerBackendRef<'a, K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { inner: ArcMutexGuard<RawMutex, Box<dyn CacheBackend<K = K, V = V>>>, _phantom: PhantomData<&'a mut ()>, } // Workaround for <https://github.com/rust-lang/rust/issues/100573>. impl<'a, K, V> Drop for InnerBackendRef<'a, K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { fn drop(&mut self) {} } impl<'a, K, V> Debug for InnerBackendRef<'a, K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("InnerBackendRef").finish_non_exhaustive() } } impl<'a, K, V> Deref for InnerBackendRef<'a, K, V> where K: Clone + Eq + Hash + Ord + Debug + Send + 'static, V: Clone + Debug + Send + 'static, { type Target = dyn CacheBackend<K = K, V = V>; fn deref(&self) -> &Self::Target { self.inner.as_ref() } } #[cfg(test)] mod tests { use std::{collections::HashMap, sync::Barrier, thread::JoinHandle}; use iox_time::MockProvider; use super::*; #[allow(dead_code)] const fn assert_send<T: Send>() {} const _: () = assert_send::<CallbackHandle<String, usize>>(); #[test] #[should_panic(expected = "inner backend is not empty")] fn test_panic_inner_not_empty() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); PolicyBackend::new( Box::new(HashMap::from([(String::from("foo"), 1usize)])), time_provider, ); } #[test] fn test_generic() { crate::backend::test_util::test_generic(|| { let time_provider = Arc::new(MockProvider::new(Time::MIN)); PolicyBackend::hashmap_backed(time_provider) }) } #[test] #[should_panic(expected = "test steps left")] fn test_meta_panic_steps_left() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::ChangeRequests(vec![]), }])); } #[test] #[should_panic(expected = "step left for get operation")] fn test_meta_panic_requires_condition_get() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![])); backend.get(&String::from("a")); } #[test] #[should_panic(expected = "step left for set operation")] fn test_meta_panic_requires_condition_set() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![])); backend.set(String::from("a"), 2); } #[test] #[should_panic(expected = "step left for remove operation")] fn test_meta_panic_requires_condition_remove() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![])); backend.remove(&String::from("a")); } #[test] #[should_panic(expected = "Condition mismatch")] fn test_meta_panic_checks_condition_get() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }])); backend.get(&String::from("b")); } #[test] #[should_panic(expected = "Condition mismatch")] fn test_meta_panic_checks_condition_set() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::ChangeRequests(vec![]), }])); backend.set(String::from("a"), 2); } #[test] #[should_panic(expected = "Condition mismatch")] fn test_meta_panic_checks_condition_remove() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![TestStep { condition: TestBackendInteraction::Remove { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }])); backend.remove(&String::from("b")); } #[test] fn test_basic_propagation() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("b"), v: 2, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Remove { k: String::from("b"), }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("b"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 1); backend.set(String::from("b"), 2); backend.remove(&String::from("b")); assert_eq!(backend.get(&String::from("a")), Some(1)); assert_eq!(backend.get(&String::from("b")), None); } #[test] #[should_panic(expected = "illegal recursive access")] fn test_panic_recursion_detection_get() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![TestStep { condition: TestBackendInteraction::Remove { k: String::from("a"), }, action: TestAction::CallBackendDirectly(TestBackendInteraction::Get { k: String::from("b"), }), }])); backend.remove(&String::from("a")); } #[test] #[should_panic(expected = "illegal recursive access")] fn test_panic_recursion_detection_set() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![TestStep { condition: TestBackendInteraction::Remove { k: String::from("a"), }, action: TestAction::CallBackendDirectly(TestBackendInteraction::Set { k: String::from("b"), v: 1, }), }])); backend.remove(&String::from("a")); } #[test] #[should_panic(expected = "illegal recursive access")] fn test_panic_recursion_detection_remove() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![TestStep { condition: TestBackendInteraction::Remove { k: String::from("a"), }, action: TestAction::CallBackendDirectly(TestBackendInteraction::Remove { k: String::from("b"), }), }])); backend.remove(&String::from("a")); } #[test] fn test_get_untracked() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::from_fn( |backend| { assert_eq!(backend.get_untracked(&String::from("a")), Some(1)); }, )]), }, // NO `GET` interaction triggered here! ])); backend.set(String::from("a"), 1); } #[test] fn test_basic_get_set() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 1, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::ChangeRequests(vec![]), }, ])); assert_eq!(backend.get(&String::from("a")), Some(1)); } #[test] fn test_basic_get_get() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::get(String::from( "a", ))]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); assert_eq!(backend.get(&String::from("a")), None); } #[test] fn test_basic_set_set_get_get() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("b"), 2, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("b"), v: 2, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("b"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 1); assert_eq!(backend.get(&String::from("a")), Some(1)); assert_eq!(backend.get(&String::from("b")), Some(2)); } #[test] fn test_basic_set_remove_get() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::remove( String::from("a"), )]), }, TestStep { condition: TestBackendInteraction::Remove { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 1); assert_eq!(backend.get(&String::from("a")), None); } #[test] fn test_basic_remove_set_get_get() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Remove { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("b"), 1, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("b"), v: 1, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("b"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.remove(&String::from("a")); assert_eq!(backend.get(&String::from("a")), None); assert_eq!(backend.get(&String::from("b")), Some(1)); } #[test] fn test_basic_remove_remove_get_get() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Remove { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::remove( String::from("b"), )]), }, TestStep { condition: TestBackendInteraction::Remove { k: String::from("b"), }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("b"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.remove(&String::from("a")); assert_eq!(backend.get(&String::from("a")), None); assert_eq!(backend.get(&String::from("b")), None); } #[test] fn test_ordering_within_requests_vector() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 11, }, action: TestAction::ChangeRequests(vec![ SendableChangeRequest::set(String::from("a"), 12), SendableChangeRequest::set(String::from("a"), 13), ]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 12, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 13, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 11); assert_eq!(backend.get(&String::from("a")), Some(13)); } #[test] fn test_ordering_across_policies() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 11, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 12, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 12, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 13, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 11, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 13, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 12, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 13, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 11); assert_eq!(backend.get(&String::from("a")), Some(13)); } #[test] fn test_ping_pong() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 11, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 12, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 12, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 13, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 14, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 14, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 11, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 13, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 12, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 13, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 14, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 11); assert_eq!(backend.get(&String::from("a")), Some(14)); } #[test] #[should_panic(expected = "this is a test")] fn test_meta_multithread_panics_are_propagated() { let barrier_pre = Arc::new(Barrier::new(2)); let barrier_post = Arc::new(Barrier::new(1)); let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::CallBackendDelayed( Arc::clone(&barrier_pre), TestBackendInteraction::Panic, Arc::clone(&barrier_post), ), }])); backend.set(String::from("a"), 1); barrier_pre.wait(); // panic on drop } /// Checks that a policy background task can access the "callback backend" without triggering /// the "illegal recursion" detection. #[test] fn test_multithread() { let barrier_pre = Arc::new(Barrier::new(2)); let barrier_post = Arc::new(Barrier::new(2)); let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::CallBackendDelayed( Arc::clone(&barrier_pre), TestBackendInteraction::Set { k: String::from("a"), v: 4, }, Arc::clone(&barrier_post), ), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 2, }, action: TestAction::BlockAndChangeRequest( Arc::clone(&barrier_pre), vec![SendableChangeRequest::set(String::from("a"), 3)], ), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 3, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 4, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 1); assert_eq!(backend.get(&String::from("a")), Some(1)); backend.set(String::from("a"), 2); barrier_post.wait(); assert_eq!(backend.get(&String::from("a")), Some(4)); } #[test] fn test_get_from_policies_are_propagated() { let barrier_pre = Arc::new(Barrier::new(2)); let barrier_post = Arc::new(Barrier::new(2)); let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 1, }, action: TestAction::CallBackendDelayed( Arc::clone(&barrier_pre), TestBackendInteraction::Get { k: String::from("a"), }, Arc::clone(&barrier_post), ), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 1); barrier_pre.wait(); barrier_post.wait(); } /// Checks that dropping [`PolicyBackend`] drop the policies as well as the inner backend. #[test] fn test_drop() { let marker_backend = Arc::new(()); let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::new( Box::new(DropTester(Arc::clone(&marker_backend), ())), time_provider, ); let marker_policy = Arc::new(()); backend.add_policy(|callback| DropTester(Arc::clone(&marker_policy), callback)); assert_eq!(Arc::strong_count(&marker_backend), 2); assert_eq!(Arc::strong_count(&marker_policy), 2); drop(backend); assert_eq!(Arc::strong_count(&marker_backend), 1); assert_eq!(Arc::strong_count(&marker_policy), 1); } /// We have to ways of handling "compound" [`ChangeRequest`]s, i.e. requests that perform /// multiple operations: /// /// 1. We could loop over the operations and inner-loop over the policies to collect reactions /// 2. We could loop over all the policies and present each polices all operations in one go /// /// We've decided to chose option 1. This test ensures that by setting up a compound request /// (reacting to `set("a", 11)`) with a compound of two operations (`set("a", 12)`, `set("a", /// 13)`) which we call `C1` and `C2` (for "compound 1 and 2"). The two policies react to /// these two compound operations as follows: /// /// | | Policy 1 | Policy 2 | /// | -- | -------------- | -------------- | /// | C1 | `set("a", 14)` | `set("a", 15)` | /// | C2 | `set("a", 16)` | -- | /// /// For option (1) the outcome will be `"a" -> 16`, for option (2) the outcome would be `"a" -> /// 15`. #[test] fn test_ordering_within_compound_requests() { let time_provider = Arc::new(MockProvider::new(Time::MIN)); let mut backend = PolicyBackend::hashmap_backed(time_provider); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 11, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::from_fn( |backend| { backend.set(String::from("a"), 12); backend.set(String::from("a"), 13); }, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 12, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 14, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 13, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 16, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 14, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 15, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 16, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.add_policy(create_test_policy(vec![ TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 11, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 12, }, action: TestAction::ChangeRequests(vec![SendableChangeRequest::set( String::from("a"), 15, )]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 13, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 14, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 15, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Set { k: String::from("a"), v: 16, }, action: TestAction::ChangeRequests(vec![]), }, TestStep { condition: TestBackendInteraction::Get { k: String::from("a"), }, action: TestAction::ChangeRequests(vec![]), }, ])); backend.set(String::from("a"), 11); assert_eq!(backend.get(&String::from("a")), Some(16)); } #[derive(Debug)] struct DropTester<T>(Arc<()>, T) where T: Debug + Send + 'static; impl<T> CacheBackend for DropTester<T> where T: Debug + Send + 'static, { type K = (); type V = (); fn get(&mut self, _k: &Self::K) -> Option<Self::V> { unreachable!() } fn set(&mut self, _k: Self::K, _v: Self::V) { unreachable!() } fn remove(&mut self, _k: &Self::K) { unreachable!() } fn is_empty(&self) -> bool { true } fn as_any(&self) -> &dyn std::any::Any { unreachable!() } } impl<T> Subscriber for DropTester<T> where T: Debug + Send + 'static, { type K = (); type V = (); } fn create_test_policy( steps: Vec<TestStep>, ) -> impl FnOnce(CallbackHandle<String, usize>) -> TestSubscriber { |handle| TestSubscriber { background_task: TestSubscriberBackgroundTask::NotStarted(handle), steps: VecDeque::from(steps), } } #[derive(Debug, PartialEq)] enum TestBackendInteraction { Get { k: String }, Set { k: String, v: usize }, Remove { k: String }, Panic, } impl TestBackendInteraction { fn perform(self, handle: &mut CallbackHandle<String, usize>) { match self { Self::Get { k } => { handle.execute_requests(vec![ChangeRequest::get(k)]); } Self::Set { k, v } => handle.execute_requests(vec![ChangeRequest::set(k, v)]), Self::Remove { k } => handle.execute_requests(vec![ChangeRequest::remove(k)]), Self::Panic => panic!("this is a test"), } } } #[derive(Debug)] enum TestAction { /// Perform an illegal direct, recursive call to the backend. CallBackendDirectly(TestBackendInteraction), /// Return change requests ChangeRequests(Vec<SendableChangeRequest>), /// Use callback backend but wait for a barrier in a background thread. /// /// This will return immediately. CallBackendDelayed(Arc<Barrier>, TestBackendInteraction, Arc<Barrier>), /// Block on barrier and return afterwards. BlockAndChangeRequest(Arc<Barrier>, Vec<SendableChangeRequest>), } impl TestAction { fn perform( self, background_task: &mut TestSubscriberBackgroundTask, ) -> Vec<ChangeRequest<'static, String, usize>> { match self { Self::CallBackendDirectly(interaction) => { let handle = match background_task { TestSubscriberBackgroundTask::NotStarted(handle) => handle, TestSubscriberBackgroundTask::Started(_) => { panic!("background task already started") } TestSubscriberBackgroundTask::Invalid => panic!("Invalid state"), }; interaction.perform(handle); unreachable!("illegal call should have failed") } Self::ChangeRequests(change_requests) => { change_requests.into_iter().map(|r| r.into()).collect() } Self::CallBackendDelayed(barrier_pre, interaction, barrier_post) => { let mut tmp = TestSubscriberBackgroundTask::Invalid; std::mem::swap(&mut tmp, background_task); let mut handle = match tmp { TestSubscriberBackgroundTask::NotStarted(handle) => handle, TestSubscriberBackgroundTask::Started(_) => { panic!("background task already started") } TestSubscriberBackgroundTask::Invalid => panic!("Invalid state"), }; let join_handle = std::thread::spawn(move || { barrier_pre.wait(); interaction.perform(&mut handle); barrier_post.wait(); }); *background_task = TestSubscriberBackgroundTask::Started(join_handle); vec![] } Self::BlockAndChangeRequest(barrier, change_requests) => { barrier.wait(); change_requests.into_iter().map(|r| r.into()).collect() } } } } #[derive(Debug)] struct TestStep { condition: TestBackendInteraction, action: TestAction, } #[derive(Debug)] enum TestSubscriberBackgroundTask { NotStarted(CallbackHandle<String, usize>), Started(JoinHandle<()>), /// Temporary variant for swapping. Invalid, } #[derive(Debug)] struct TestSubscriber { background_task: TestSubscriberBackgroundTask, steps: VecDeque<TestStep>, } impl Drop for TestSubscriber { fn drop(&mut self) { // prevent SIGABRT due to double-panic if !std::thread::panicking() { assert!(self.steps.is_empty(), "test steps left"); let mut tmp = TestSubscriberBackgroundTask::Invalid; std::mem::swap(&mut tmp, &mut self.background_task); match tmp { TestSubscriberBackgroundTask::NotStarted(_) => { // nothing to check } TestSubscriberBackgroundTask::Started(handle) => { // propagate panics if let Err(e) = handle.join() { if let Some(err) = e.downcast_ref::<&str>() { panic!("Error in background task: {err}") } else if let Some(err) = e.downcast_ref::<String>() { panic!("Error in background task: {err}") } else { panic!("Error in background task: <unknown>") } } } TestSubscriberBackgroundTask::Invalid => { // that's OK during drop } } } } } impl Subscriber for TestSubscriber { type K = String; type V = usize; fn get( &mut self, k: &Self::K, _now: Time, ) -> Vec<ChangeRequest<'static, Self::K, Self::V>> { let step = self.steps.pop_front().expect("step left for get operation"); let expected_condition = TestBackendInteraction::Get { k: k.clone() }; assert_eq!( step.condition, expected_condition, "Condition mismatch\n\nActual:\n{:#?}\n\nExpected:\n{:#?}", step.condition, expected_condition, ); step.action.perform(&mut self.background_task) } fn set( &mut self, k: &Self::K, v: &Self::V, _now: Time, ) -> Vec<ChangeRequest<'static, String, usize>> { let step = self.steps.pop_front().expect("step left for set operation"); let expected_condition = TestBackendInteraction::Set { k: k.clone(), v: *v, }; assert_eq!( step.condition, expected_condition, "Condition mismatch\n\nActual:\n{:#?}\n\nExpected:\n{:#?}", step.condition, expected_condition, ); step.action.perform(&mut self.background_task) } fn remove( &mut self, k: &Self::K, _now: Time, ) -> Vec<ChangeRequest<'static, String, usize>> { let step = self .steps .pop_front() .expect("step left for remove operation"); let expected_condition = TestBackendInteraction::Remove { k: k.clone() }; assert_eq!( step.condition, expected_condition, "Condition mismatch\n\nActual:\n{:#?}\n\nExpected:\n{:#?}", step.condition, expected_condition, ); step.action.perform(&mut self.background_task) } } /// Same as [`ChangeRequestFn`] but implements `Send`. type SendableChangeRequestFn = Box<dyn for<'a> FnOnce(&'a mut Recorder<String, usize>) + Send + 'static>; /// Same as [`ChangeRequest`] but implements `Send`. struct SendableChangeRequest { fun: SendableChangeRequestFn, } impl Debug for SendableChangeRequest { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("SendableCacheRequest") .finish_non_exhaustive() } } impl SendableChangeRequest { fn from_fn<F>(f: F) -> Self where F: for<'b> FnOnce(&'b mut Recorder<String, usize>) + Send + 'static, { Self { fun: Box::new(f) } } fn get(k: String) -> Self { Self::from_fn(move |backend| { backend.get(&k); }) } fn set(k: String, v: usize) -> Self { Self::from_fn(move |backend| { backend.set(k, v); }) } fn remove(k: String) -> Self { Self::from_fn(move |backend| { backend.remove(&k); }) } } impl From<SendableChangeRequest> for ChangeRequest<'static, String, usize> { fn from(request: SendableChangeRequest) -> Self { Self::from_fn(request.fun) } } }
// Copyright 2020 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::sync::Arc; use common_datavalues::DataSchemaRef; use common_meta_types::TableInfo; use crate::Expression; use crate::Extras; use crate::Partitions; use crate::ScanPlan; use crate::Statistics; // TODO: Delete the scan plan field, but it depends on plan_parser:L394 #[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq)] pub struct ReadDataSourcePlan { pub table_info: TableInfo, pub parts: Partitions, pub statistics: Statistics, pub description: String, pub scan_plan: Arc<ScanPlan>, pub tbl_args: Option<Vec<Expression>>, pub push_downs: Option<Extras>, } impl ReadDataSourcePlan { pub fn schema(&self) -> DataSchemaRef { self.table_info.schema.clone() } }
// Copyright 2019 The Gotts Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use crate::rest::*; use crate::router::{Handler, ResponseFuture}; use crate::web::*; use chrono::SecondsFormat; use hyper::{Body, Request}; use std::sync::Weak; extern crate gotts_oracle_alphavantage; use alphavantage::exchange_rate::ExchangeRate; use alphavantage::exchange_rate::ExchangeRateResult; use gotts_oracle_alphavantage as alphavantage; pub struct IndexHandler { pub list: Vec<String>, } impl IndexHandler {} impl Handler for IndexHandler { fn get(&self, _req: Request<Body>) -> ResponseFuture { json_response_pretty(&self.list) } } pub struct ExchangeHandler { pub client: Weak<alphavantage::Client>, } impl ExchangeHandler { fn get_rate(&self, req: Request<Body>) -> Result<ExchangeRateResult, Error> { let query = must_get_query!(req); let params = QueryParams::from(query); let from = parse_param_no_err!(params, "from", "USD".to_owned()); let to = parse_param_no_err!(params, "to", "CNY".to_owned()); let arc_client = w(&self.client)?; let exchange_rate = crossbeam::scope(|scope| { let handle = scope.spawn(move |_| -> Result<ExchangeRate, Error> { let exchange_result = arc_client.get_exchange_rate(&from, &to); let result = match exchange_result { Ok(result) => Ok(result), Err(_e) => Err(ErrorKind::RequestError( "query alphavantage failed!".to_owned(), ))?, }; result }); handle.join().unwrap() }); let result: ExchangeRate = exchange_rate.unwrap().unwrap(); let exchange_rate_result = ExchangeRateResult { from: result.from.code.to_string(), to: result.to.code.to_string(), rate: result.rate, date: result .date .to_rfc3339_opts(SecondsFormat::Secs, true) .to_string(), }; Ok(exchange_rate_result) } } impl Handler for ExchangeHandler { fn get(&self, req: Request<Body>) -> ResponseFuture { result_to_response(self.get_rate(req)) } }
// Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use {InternalIterator, Point}; use cgmath::{EuclideanSpace, Matrix4, Point3, Vector2}; use collision::{Aabb, Aabb3, Contains, Discrete, Frustum, Relation}; use errors::*; use fnv::FnvHashMap; use math::Cube; use num_traits::Zero; use proto; use protobuf; use std::fs::File; use std::io::{BufReader, Cursor, Read}; use std::path::{Path, PathBuf}; mod node; pub use self::node::{ChildIndex, Node, NodeId, NodeIterator, NodeMeta, NodeWriter, PositionEncoding}; pub const CURRENT_VERSION: i32 = 9; #[derive(Debug)] pub struct OctreeMeta { pub directory: PathBuf, pub resolution: f64, pub bounding_box: Aabb3<f32>, } #[derive(Debug)] pub struct VisibleNode { pub id: NodeId, pixels: Vector2<f32>, } impl VisibleNode { pub fn new(id: NodeId) -> VisibleNode { VisibleNode { id, pixels: Vector2::zero(), } } } // TODO(hrapp): something is funky here. "r" is smaller on screen than "r4" in many cases, though // that is impossible. fn project(m: &Matrix4<f32>, p: &Point3<f32>) -> Point3<f32> { let d = 1. / (m[0][3] * p.x + m[1][3] * p.y + m[2][3] * p.z + m[3][3]); Point3::new( (m[0][0] * p.x + m[1][0] * p.y + m[2][0] * p.z + m[3][0]) * d, (m[0][1] * p.x + m[1][1] * p.y + m[2][1] * p.z + m[3][1]) * d, (m[0][2] * p.x + m[1][2] * p.y + m[2][2] * p.z + m[3][2]) * d, ) } fn size_in_pixels( bounding_cube: &Cube, matrix: &Matrix4<f32>, width: i32, height: i32, ) -> Vector2<f32> { // z is unused here. let min = bounding_cube.min(); let max = bounding_cube.max(); let mut rv = Aabb3::zero(); for p in &[ Point3::new(min.x, min.y, min.z), Point3::new(max.x, min.y, min.z), Point3::new(min.x, max.y, min.z), Point3::new(max.x, max.y, min.z), Point3::new(min.x, min.y, max.z), Point3::new(max.x, min.y, max.z), Point3::new(min.x, max.y, max.z), Point3::new(max.x, max.y, max.z), ] { rv = rv.grow(project(matrix, p)); } Vector2::new( (rv.max().x - rv.min().x) * (width as f32) / 2., (rv.max().y - rv.min().y) * (height as f32) / 2., ) } #[derive(Debug)] pub struct OnDiskOctree { meta: OctreeMeta, nodes: FnvHashMap<NodeId, NodeMeta>, } pub trait Octree: Send + Sync { fn get_visible_nodes( &self, projection_matrix: &Matrix4<f32>, width: i32, height: i32, ) -> Vec<VisibleNode>; fn get_node_data(&self, node_id: &NodeId) -> Result<NodeData>; } pub struct PointsInBoxIterator<'a> { octree_meta: &'a OctreeMeta, aabb: &'a Aabb3<f32>, intersecting_nodes: Vec<NodeId>, } impl<'a> InternalIterator for PointsInBoxIterator<'a> { fn size_hint(&self) -> Option<usize> { None } fn for_each<F: FnMut(&Point)>(self, mut f: F) { for node_id in &self.intersecting_nodes { // TODO(sirver): This crashes on error. We should bubble up an error. let iterator = NodeIterator::from_disk(&self.octree_meta, node_id) .expect("Could not read node points"); iterator.for_each(|p| { if !self.aabb.contains(&Point3::from_vec(p.position)) { return; } f(p); }); } } } pub fn read_meta_proto<P: AsRef<Path>>(directory: P) -> Result<proto::Meta> { // We used to use JSON earlier. if directory.as_ref().join("meta.json").exists() { return Err(ErrorKind::InvalidVersion(3).into()); } let mut data = Vec::new(); File::open(&directory.as_ref().join("meta.pb"))?.read_to_end(&mut data)?; Ok( protobuf::parse_from_reader::<proto::Meta>(&mut Cursor::new(data)) .chain_err(|| "Could not parse meta.pb")?, ) } #[derive(Debug)] pub struct NodeData { pub meta: node::NodeMeta, pub position: Vec<u8>, pub color: Vec<u8>, } impl OnDiskOctree { // TODO(sirver): This creates an object that is only partially usable. pub fn from_meta(meta_proto: proto::Meta, directory: PathBuf) -> Result<Self> { if meta_proto.version != CURRENT_VERSION { return Err(ErrorKind::InvalidVersion(meta_proto.version).into()); } let bounding_box = { let bounding_box = meta_proto.bounding_box.unwrap(); let min = bounding_box.min.unwrap(); let max = bounding_box.max.unwrap(); Aabb3::new( Point3::new(min.x, min.y, min.z), Point3::new(max.x, max.y, max.z), ) }; let meta = OctreeMeta { directory: directory.into(), resolution: meta_proto.resolution, bounding_box: bounding_box, }; let mut nodes = FnvHashMap::default(); for node_proto in meta_proto.nodes.iter() { let node_id = NodeId::from_level_index( node_proto.id.as_ref().unwrap().level as u8, node_proto.id.as_ref().unwrap().index as usize, ); nodes.insert( node_id, NodeMeta { num_points: node_proto.num_points, position_encoding: PositionEncoding::from_proto(node_proto.position_encoding)?, bounding_cube: node_id.find_bounding_cube(&Cube::bounding(&meta.bounding_box)), }, ); } Ok(OnDiskOctree { meta, nodes }) } pub fn new<P: AsRef<Path>>(directory: P) -> Result<Self> { let directory = directory.as_ref().to_owned(); let meta_proto = read_meta_proto(&directory)?; Self::from_meta(meta_proto, directory) } /// Returns the ids of all nodes that cut or are fully contained in 'aabb'. pub fn points_in_box<'a>(&'a self, aabb: &'a Aabb3<f32>) -> PointsInBoxIterator<'a> { let mut intersecting_nodes = Vec::new(); let mut open_list = vec![ Node::root_with_bounding_cube(Cube::bounding(&self.meta.bounding_box)), ]; while !open_list.is_empty() { let current = open_list.pop().unwrap(); if !aabb.intersects(&current.bounding_cube.to_aabb3()) { continue; } intersecting_nodes.push(current.id); for child_index in 0..8 { let child = current.get_child(ChildIndex::from_u8(child_index)); if self.nodes.contains_key(&child.id) { open_list.push(child); } } } PointsInBoxIterator { octree_meta: &self.meta, aabb, intersecting_nodes, } } pub fn bounding_box(&self) -> &Aabb3<f32> { &self.meta.bounding_box } } impl Octree for OnDiskOctree { fn get_visible_nodes( &self, projection_matrix: &Matrix4<f32>, width: i32, height: i32, ) -> Vec<VisibleNode> { let frustum = Frustum::from_matrix4(*projection_matrix).unwrap(); let mut open = vec![ Node::root_with_bounding_cube(Cube::bounding(&self.meta.bounding_box)), ]; let mut visible = Vec::new(); while !open.is_empty() { let node_to_explore = open.pop().unwrap(); let meta = self.nodes.get(&node_to_explore.id); if meta.is_none() || frustum.contains(&node_to_explore.bounding_cube.to_aabb3()) == Relation::Out { continue; } let pixels = size_in_pixels( &node_to_explore.bounding_cube, projection_matrix, width, height, ); let visible_pixels = pixels.x * pixels.y; const MIN_PIXELS_SQ: f32 = 120.; const MIN_PIXELS_SIDE: f32 = 12.; if pixels.x < MIN_PIXELS_SIDE || pixels.y < MIN_PIXELS_SIDE || visible_pixels < MIN_PIXELS_SQ { continue; } for child_index in 0..8 { open.push(node_to_explore.get_child(ChildIndex::from_u8(child_index))) } visible.push(VisibleNode { id: node_to_explore.id, pixels: pixels, }); } visible.sort_by(|a, b| { let size_a = a.pixels.x * a.pixels.y; let size_b = b.pixels.x * b.pixels.y; size_b.partial_cmp(&size_a).unwrap() }); visible } fn get_node_data(&self, node_id: &NodeId) -> Result<NodeData> { let stem = node_id.get_stem(&self.meta.directory); // TODO(hrapp): If we'd randomize the points while writing, we could just read the // first N points instead of reading everything and skipping over a few. let position = { let mut xyz_reader = BufReader::new(File::open(&stem.with_extension(node::POSITION_EXT))?); let mut all_data = Vec::new(); xyz_reader .read_to_end(&mut all_data) .chain_err(|| "Could not read position")?; all_data }; let color = { let mut rgb_reader = BufReader::new(File::open(&stem.with_extension(node::COLOR_EXT)) .chain_err(|| "Could not read color")?); let mut all_data = Vec::new(); rgb_reader .read_to_end(&mut all_data) .chain_err(|| "Could not read color")?; all_data }; Ok(NodeData { position: position, color: color, meta: self.nodes[node_id].clone(), }) } }
use crate::ray::{Hit, Hitable, Ray}; impl Hitable for Vec<Box<dyn Hitable>> { fn hit(&self, ray: &Ray, t_min: f64, t_max: f64, hit: &mut Hit) -> bool { let mut hit_anything = false; let mut closest_so_far = t_max; for hitable in self.iter() { if hitable.hit(ray, t_min, closest_so_far, hit) { hit_anything = true; closest_so_far = hit.t; } } hit_anything } } pub type HitableList = Vec<Box<dyn Hitable>>;
use morgan_interface::account::Account; use morgan_interface::genesis_block::GenesisBlock; use morgan_interface::pubkey::Pubkey; use morgan_interface::signature::{Keypair, KeypairUtil}; use morgan_interface::system_program; use morgan_stake_api::stake_state; use morgan_vote_api::vote_state; // The default stake placed with the bootstrap leader pub const BOOTSTRAP_LEADER_DIFS: u64 = 42; pub struct GenesisBlockInfo { pub genesis_block: GenesisBlock, pub mint_keypair: Keypair, pub voting_keypair: Keypair, } pub fn create_genesis_block_with_leader( mint_difs: u64, bootstrap_leader_pubkey: &Pubkey, bootstrap_leader_stake_difs: u64, ) -> GenesisBlockInfo { let mint_keypair = Keypair::new(); let voting_keypair = Keypair::new(); let staking_keypair = Keypair::new(); // TODO: de-duplicate the stake once passive staking // is fully implemented let (vote_account, vote_state) = vote_state::create_bootstrap_leader_account( &voting_keypair.pubkey(), &bootstrap_leader_pubkey, 0, bootstrap_leader_stake_difs, ); let genesis_block = GenesisBlock::new( &bootstrap_leader_pubkey, &[ // the mint ( mint_keypair.pubkey(), Account::new(mint_difs, 0, 0, &system_program::id()), ), // node needs an account to issue votes and storage proofs from, this will require // airdrops at some point to cover fees... ( *bootstrap_leader_pubkey, Account::new(42, 0, 0, &system_program::id()), ), // where votes go to (voting_keypair.pubkey(), vote_account), // passive bootstrap leader stake, duplicates above temporarily ( staking_keypair.pubkey(), stake_state::create_delegate_stake_account( &voting_keypair.pubkey(), &vote_state, bootstrap_leader_stake_difs, ), ), ], &[morgan_vote_controller!(), morgan_vote_controller!()], ); GenesisBlockInfo { genesis_block, mint_keypair, voting_keypair, } }
fn main() { let points = 10i32; let mut saved_points: u32 = 0; saved_points = points as u32; }
//! A macro to generate the corresponding Generations rule of a rule. #![macro_use] /// Implements `Rule` trait for a rule and the corresponding Generations rule. macro_rules! impl_rule { { $(#[$doc_desc:meta])* pub struct NbhdDesc($desc_type:ty); $(#[$doc:meta])* pub struct $rule:ident { Parser: $parser:ident, impl_table: $impl_table:ty $(,)? } $(#[$doc_gen:meta])* pub struct $rule_gen:ident { Parser: $parser_gen:ident, } fn new_desc { ALIVE => $alive_desc:expr, DEAD => $dead_desc:expr, } fn update_desc( $cell:ident, $state:ident, $new:ident, $change_num:ident $(,)? ) $update_desc_body:block fn consistify<$a:lifetime>( $world:ident, $cell_cons:ident, $flags:ident $(,)? ) $consistify_body:block fn consistify_gen<$a_gen:lifetime>( $world_gen:ident, $cell_cons_gen:ident, $flags_gen:ident $(,)? ) $consistify_gen_body:block } => { $(#[$doc_desc])* #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub struct NbhdDesc($desc_type); $(#[$doc])* pub struct $rule { /// Whether the rule contains `B0`. b0: bool, /// Whether the rule contains `S8`. s8: bool, /// An array of actions for all neighborhood descriptors. impl_table: $impl_table, } /// A parser for the rule. impl $parser for $rule { fn from_bs(b: Vec<u8>, s: Vec<u8>) -> Self { Self::new(b, s) } } impl FromStr for $rule { type Err = Error; fn from_str(input: &str) -> Result<Self, Self::Err> { let rule: $rule = $parser::parse_rule(input) .map_err(Error::ParseRuleError)?; if rule.has_b0_s8() { Err(Error::B0S8Error) } else { Ok(rule) } } } impl Rule for $rule { type Desc = NbhdDesc; const IS_GEN: bool = false; fn has_b0(&self) -> bool { self.b0 } fn has_b0_s8(&self) -> bool { self.b0 && self.s8 } fn gen(&self) -> usize { 2 } fn new_desc(state: State, succ_state: State) -> Self::Desc { let nbhd_state = match state { ALIVE => $alive_desc, _ => $dead_desc, }; let succ_state = match succ_state { ALIVE => 0b01, _ => 0b10, }; let state = match state { ALIVE => 0b01, _ => 0b10, }; NbhdDesc(nbhd_state << 4 | succ_state << 2 | state) } fn update_desc( $cell: CellRef<Self>, $state: Option<State>, $new: bool, ) { $update_desc_body let change_num = match $state { Some(ALIVE) => 0b01, Some(_) => 0b10, _ => 0, }; if let Some(pred) = $cell.pred { let mut desc = pred.desc.get(); desc.0 ^= change_num << 2; pred.desc.set(desc); } let mut desc = $cell.desc.get(); desc.0 ^= change_num; $cell.desc.set(desc); } fn consistify<$a>($world: &mut World<$a, Self>, $cell_cons: CellRef<$a, Self>) -> bool { let $flags = $world.rule.impl_table[$cell_cons.desc.get().0 as usize]; if $flags.is_empty() { return true; } if $flags.contains(ImplFlags::CONFLICT) { return false; } if $flags.intersects(ImplFlags::SUCC) { let state = if $flags.contains(ImplFlags::SUCC_DEAD) { DEAD } else { ALIVE }; let succ = $cell_cons.succ.unwrap(); return $world.set_cell(succ, state, Reason::Deduce); } if $flags.intersects(ImplFlags::SELF) { let state = if $flags.contains(ImplFlags::SELF_DEAD) { DEAD } else { ALIVE }; if !$world.set_cell($cell_cons, state, Reason::Deduce) { return false; } } if $flags.intersects(ImplFlags::NBHD) { $consistify_body } true } } /// The neighborhood descriptor. /// /// Including a descriptor for the corresponding non-Generations rule, /// and the states of the successor. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub struct NbhdDescGen ($desc_type, Option<State>); $(#[$doc_gen])* pub struct $rule_gen { /// Whether the rule contains `B0`. b0: bool, /// Whether the rule contains `S8`. s8: bool, /// Number of states. gen: usize, /// An array of actions for all neighborhood descriptors. impl_table: $impl_table, } impl $rule_gen { /// Constructs a new rule from the `b` and `s` data /// and the number of states. pub fn new(b: Vec<u8>, s: Vec<u8>, gen: usize) -> Self { let life = $rule::new(b, s); let impl_table = life.impl_table; Self { b0: life.b0, s8: life.s8, gen, impl_table, } } /// Converts to the corresponding non-Generations rule. pub fn non_gen(self) -> $rule { $rule { b0: self.b0, s8: self.s8, impl_table: self.impl_table, } } } /// A parser for the rule. impl $parser_gen for $rule_gen { fn from_bsg(b: Vec<u8>, s: Vec<u8>, gen: usize) -> Self { Self::new(b, s, gen) } } impl FromStr for $rule_gen { type Err = Error; fn from_str(input: &str) -> Result<Self, Self::Err> { let rule: $rule_gen = $parser_gen::parse_rule(input) .map_err(Error::ParseRuleError)?; if rule.has_b0_s8() { Err(Error::B0S8Error) } else { Ok(rule) } } } /// NOTE: This implementation does work when the number of states is 2. impl Rule for $rule_gen { type Desc = NbhdDescGen; const IS_GEN: bool = true; fn has_b0(&self) -> bool { self.b0 } fn has_b0_s8(&self) -> bool { self.b0 && self.s8 } fn gen(&self) -> usize { self.gen } fn new_desc(state: State, succ_state: State) -> Self::Desc { let desc = $rule::new_desc(state, succ_state); NbhdDescGen(desc.0, Some(succ_state)) } fn update_desc( $cell: CellRef<Self>, $state: Option<State>, $new: bool, ) { $update_desc_body let $change_num = match $state { Some(ALIVE) => 0b01, Some(_) => 0b10, _ => 0, }; if let Some(pred) = $cell.pred { let mut desc = pred.desc.get(); desc.0 ^= $change_num << 2; desc.1 = if $new { $state } else { None }; pred.desc.set(desc); } let mut desc = $cell.desc.get(); desc.0 ^= $change_num; $cell.desc.set(desc); } fn consistify<$a_gen>( $world_gen: &mut World<$a_gen, Self>, $cell_cons_gen: CellRef<$a_gen, Self>, ) -> bool { let desc = $cell_cons_gen.desc.get(); let $flags_gen = $world_gen.rule.impl_table[desc.0 as usize]; let gen = $world_gen.rule.gen; match $cell_cons_gen.state.get() { Some(DEAD) => { if let Some(State(j)) = desc.1 { if j >= 2 { return false; } } if $flags_gen.intersects(ImplFlags::SUCC) { let state = if $flags_gen.contains(ImplFlags::SUCC_DEAD) { DEAD } else { ALIVE }; let succ = $cell_cons_gen.succ.unwrap(); return $world_gen.set_cell(succ, state, Reason::Deduce); } } Some(ALIVE) => { if let Some(State(j)) = desc.1 { if j == 0 || j > 2 { return false; } } if $flags_gen.intersects(ImplFlags::SUCC) { let state = if $flags_gen.contains(ImplFlags::SUCC_DEAD) { State(2) } else { ALIVE }; let succ = $cell_cons_gen.succ.unwrap(); return $world_gen.set_cell(succ, state, Reason::Deduce); } } Some(State(i)) => { assert!(i >= 2); if let Some(State(j)) = desc.1 { return j == (i + 1) % gen; } else { let succ = $cell_cons_gen.succ.unwrap(); return $world_gen.set_cell(succ, State((i + 1) % gen), Reason::Deduce); } } None => match desc.1 { Some(DEAD) => { if $flags_gen.contains(ImplFlags::SELF_ALIVE) { return $world_gen.set_cell( $cell_cons_gen, State(gen - 1), Reason::Deduce ); } else { return true; } } Some(ALIVE) => { if $flags_gen.intersects(ImplFlags::SELF) { let state = if $flags_gen.contains(ImplFlags::SELF_DEAD) { DEAD } else { ALIVE }; if !$world_gen.set_cell($cell_cons_gen, state, Reason::Deduce) { return false; } } } Some(State(j)) => { return $world_gen.set_cell( $cell_cons_gen, State(j - 1), Reason::Deduce ); } None => return true, }, } if $flags_gen.is_empty() { return true; } if $flags_gen.contains(ImplFlags::CONFLICT) { return false; } $consistify_gen_body true } } }; }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type UsbBulkInEndpointDescriptor = *mut ::core::ffi::c_void; pub type UsbBulkInPipe = *mut ::core::ffi::c_void; pub type UsbBulkOutEndpointDescriptor = *mut ::core::ffi::c_void; pub type UsbBulkOutPipe = *mut ::core::ffi::c_void; pub type UsbConfiguration = *mut ::core::ffi::c_void; pub type UsbConfigurationDescriptor = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct UsbControlRecipient(pub i32); impl UsbControlRecipient { pub const Device: Self = Self(0i32); pub const SpecifiedInterface: Self = Self(1i32); pub const Endpoint: Self = Self(2i32); pub const Other: Self = Self(3i32); pub const DefaultInterface: Self = Self(4i32); } impl ::core::marker::Copy for UsbControlRecipient {} impl ::core::clone::Clone for UsbControlRecipient { fn clone(&self) -> Self { *self } } pub type UsbControlRequestType = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct UsbControlTransferType(pub i32); impl UsbControlTransferType { pub const Standard: Self = Self(0i32); pub const Class: Self = Self(1i32); pub const Vendor: Self = Self(2i32); } impl ::core::marker::Copy for UsbControlTransferType {} impl ::core::clone::Clone for UsbControlTransferType { fn clone(&self) -> Self { *self } } pub type UsbDescriptor = *mut ::core::ffi::c_void; pub type UsbDevice = *mut ::core::ffi::c_void; pub type UsbDeviceClass = *mut ::core::ffi::c_void; pub type UsbDeviceClasses = *mut ::core::ffi::c_void; pub type UsbDeviceDescriptor = *mut ::core::ffi::c_void; pub type UsbEndpointDescriptor = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct UsbEndpointType(pub i32); impl UsbEndpointType { pub const Control: Self = Self(0i32); pub const Isochronous: Self = Self(1i32); pub const Bulk: Self = Self(2i32); pub const Interrupt: Self = Self(3i32); } impl ::core::marker::Copy for UsbEndpointType {} impl ::core::clone::Clone for UsbEndpointType { fn clone(&self) -> Self { *self } } pub type UsbInterface = *mut ::core::ffi::c_void; pub type UsbInterfaceDescriptor = *mut ::core::ffi::c_void; pub type UsbInterfaceSetting = *mut ::core::ffi::c_void; pub type UsbInterruptInEndpointDescriptor = *mut ::core::ffi::c_void; pub type UsbInterruptInEventArgs = *mut ::core::ffi::c_void; pub type UsbInterruptInPipe = *mut ::core::ffi::c_void; pub type UsbInterruptOutEndpointDescriptor = *mut ::core::ffi::c_void; pub type UsbInterruptOutPipe = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct UsbReadOptions(pub u32); impl UsbReadOptions { pub const None: Self = Self(0u32); pub const AutoClearStall: Self = Self(1u32); pub const OverrideAutomaticBufferManagement: Self = Self(2u32); pub const IgnoreShortPacket: Self = Self(4u32); pub const AllowPartialReads: Self = Self(8u32); } impl ::core::marker::Copy for UsbReadOptions {} impl ::core::clone::Clone for UsbReadOptions { fn clone(&self) -> Self { *self } } pub type UsbSetupPacket = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct UsbTransferDirection(pub i32); impl UsbTransferDirection { pub const Out: Self = Self(0i32); pub const In: Self = Self(1i32); } impl ::core::marker::Copy for UsbTransferDirection {} impl ::core::clone::Clone for UsbTransferDirection { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct UsbWriteOptions(pub u32); impl UsbWriteOptions { pub const None: Self = Self(0u32); pub const AutoClearStall: Self = Self(1u32); pub const ShortPacketTerminate: Self = Self(2u32); } impl ::core::marker::Copy for UsbWriteOptions {} impl ::core::clone::Clone for UsbWriteOptions { fn clone(&self) -> Self { *self } }
use anyhow::Result; use diesel::PgConnection; use super::entity::Paste; use super::orm; use crate::utils::is_url; pub fn create_paste(paste: &mut Paste, conn: &PgConnection) -> Result<usize> { paste.is_url = Some(is_url(paste.body.clone())); orm::create_paste(paste, conn) } pub fn get_paste(id: String, connection: &PgConnection) -> Result<Paste> { orm::get_paste(id, connection) } pub fn update_paste(paste: &mut Paste, conn: &PgConnection) -> Result<Paste> { paste.is_url = Some(is_url(paste.body.clone())); orm::update_paste(paste, conn) }
use crate::{DocBase, VarType}; pub fn gen_doc() -> Vec<DocBase> { let fn_doc = DocBase { var_type: VarType::Function, name: "floor", signatures: vec![], description: "", example: "", returns: "The largest integer less than or equal to the given number.", arguments: "", remarks: "", links: "[ceil](#fun-ceil) [round](#fun-round)", }; vec![fn_doc] }
use crate::tokenizer::{OperationType, Token}; pub fn process_token_list(tokens: &[Token]) -> Option<i64> { let size = tokens.len(); if size == 0 { return Some(0); } let mut result = 0; let mut token_index = 0; let mut value_index = 0; for index in 0..size { let token = &tokens[index]; if let Token::Operator(operator_type) = token { if token_index == 0 { token_index = index; } if value_index + 1 < token_index { if value_index == 0 { result = tokens[value_index].get_opt_value()?; } result = process_operation(operator_type, result, tokens[value_index + 1].get_opt_value()?)?; value_index += 1; } else { // invalid expression return None; } } } Some(result) } fn process_operation(operator: &OperationType, value_a: i64, value_b: i64) -> Option<i64> { match operator { OperationType::Addition => value_a.checked_add(value_b), OperationType::Subtraction => value_a.checked_sub(value_b), } } #[cfg(test)] mod tests { use super::*; #[test] fn test_valid_add_tokens() { assert_eq!( process_token_list(&[ Token::Value(1), Token::Value(1), Token::Operator(OperationType::Addition) ]), Some(2) ) } #[test] fn test_valid_sub_tokens() { assert_eq!( process_token_list(&[ Token::Value(1), Token::Value(1), Token::Operator(OperationType::Subtraction) ]), Some(0) ) } #[test] fn test_valid_add_sub_tokens() { assert_eq!( process_token_list(&[ Token::Value(1), Token::Value(1), Token::Value(2), Token::Operator(OperationType::Addition), Token::Operator(OperationType::Subtraction) ]), Some(0) ) } #[test] fn test_valid_sub_add_tokens() { assert_eq!( process_token_list(&[ Token::Value(1), Token::Value(1), Token::Value(2), Token::Operator(OperationType::Subtraction), Token::Operator(OperationType::Addition) ]), Some(2) ) } #[test] fn test_invalid_add_tokens() { assert_eq!( process_token_list(&[ Token::Value(1), Token::Operator(OperationType::Addition) ]), None ) } #[test] fn test_invalid_sub_tokens() { assert_eq!( process_token_list(&[ Token::Value(1), Token::Operator(OperationType::Subtraction) ]), None ) } #[test] fn test_valid_add_operator() { assert_eq!(process_operation(&OperationType::Addition, 0, 1), Some(1)) } #[test] fn test_valid_sub_operator() { assert_eq!( process_operation(&OperationType::Subtraction, 1, 1), Some(0) ) } #[test] fn test_invalid_add_operator() { assert_eq!( process_operation(&OperationType::Addition, i64::MAX, 1), None ) } #[test] fn test_invalid_sub_operator() { assert_eq!( process_operation(&OperationType::Subtraction, i64::MIN, i64::MAX), None ) } }
use P63::*; pub fn main() { let cbt = complete_binary_tree(6, 'x'); println!("{}", cbt); }
struct ProconReader<R: std::io::Read> { reader: R, } impl<R: std::io::Read> ProconReader<R> { fn new(reader: R) -> Self { Self { reader } } fn get<T: std::str::FromStr>(&mut self) -> T { use std::io::Read; let buf = self .reader .by_ref() .bytes() .map(|b| b.unwrap()) .skip_while(|&byte| byte == b' ' || byte == b'\n' || byte == b'\r') .take_while(|&byte| byte != b' ' && byte != b'\n' && byte != b'\r') .collect::<Vec<_>>(); std::str::from_utf8(&buf) .unwrap() .parse() .ok() .expect("Parse Error.") } } struct SegmentTree<T, F> { n: usize, dat: Vec<T>, e: T, multiply: F, } impl<T, F> SegmentTree<T, F> where T: Copy, F: Fn(T, T) -> T, { fn new(n: usize, e: T, multiply: F) -> Self { let n = n.next_power_of_two(); Self { n, dat: vec![e; n * 2 - 1], e, multiply, } } fn get(&self, i: usize) -> T { self.dat[i + self.n - 1] } fn update(&mut self, i: usize, x: T) { let mut k = i + self.n - 1; self.dat[k] = x; while k > 0 { k = (k - 1) / 2; self.dat[k] = (self.multiply)(self.dat[k * 2 + 1], self.dat[k * 2 + 2]); } } fn fold(&self, range: std::ops::Range<usize>) -> T { self._fold(&range, 0, 0..self.n) } fn _fold( &self, range: &std::ops::Range<usize>, i: usize, i_range: std::ops::Range<usize>, ) -> T { if range.end <= i_range.start || i_range.end <= range.start { return self.e; } if range.start <= i_range.start && i_range.end <= range.end { return self.dat[i]; } let m = (i_range.start + i_range.end) / 2; (self.multiply)( self._fold(range, i * 2 + 1, i_range.start..m), self._fold(range, i * 2 + 2, m..i_range.end), ) } } fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let n: usize = rd.get(); let q: usize = rd.get(); let a: Vec<usize> = (0..n).map(|_| rd.get()).collect(); let inf = std::usize::MAX; let mut seg = SegmentTree::new( n, (inf, inf), |(a, i), (b, j)| { if a <= b { (a, i) } else { (b, j) } }, ); for i in 0..n { seg.update(i, (a[i], i)); } for _ in 0..q { let t: usize = rd.get(); let l: usize = rd.get(); let r: usize = rd.get(); match t { 1 => { let (al, _) = seg.get(l - 1); let (ar, _) = seg.get(r - 1); seg.update(l - 1, (ar, l - 1)); seg.update(r - 1, (al, r - 1)); } 2 => { let (_, i) = seg.fold((l - 1)..r); println!("{}", i + 1); } _ => unreachable!(), } } }
pub mod large; pub mod small; use liblumen_alloc::erts::exception::InternalResult; use liblumen_alloc::erts::term::prelude::*; use liblumen_alloc::erts::Process; use super::decode_vec_term; fn decode<'a>( process: &Process, safe: bool, bytes: &'a [u8], len: usize, ) -> InternalResult<(Term, &'a [u8])> { let (element_vec, after_elements_vec) = decode_vec_term(process, safe, bytes, len)?; let tuple = process.tuple_from_slice(&element_vec); Ok((tuple, after_elements_vec)) }
use super::core_namespace::*; use super::super::symbol::*; use futures::*; use gluon::{Thread, Compiler}; use gluon::vm::{ExternModule, Result, Variants}; use gluon::vm::api::{VmType, FunctionRef, ValueRef, ActiveThread, Getable, Pushable, UserdataValue}; use gluon::vm::api::generic::{A}; use gluon::import; use desync::{Desync}; use std::sync::*; use std::result; use std::fmt; use std::fmt::{Debug, Formatter}; use std::collections::{HashSet, HashMap}; use std::any::{Any}; /// /// Data passed through the derived state monad /// #[derive(Userdata, VmType, Trace)] #[gluon_trace(skip)] #[gluon(vm_type = "flo.computed.prim.DerivedStateData")] pub struct DerivedStateData { /// The namespace that this state is for namespace: Arc<Desync<GluonScriptNamespace>>, /// The symbols that the last value of this state depended upon dependencies: HashSet<FloScriptSymbol>, /// The streams that are active in this state, mapped by the symbol they're active for active_streams: HashMap<FloScriptSymbol, Mutex<Box<dyn Any+Send>>> } /// Container type used so we can use 'Any' to get the stream of the appropriate type struct StreamRef<TItem>(Box<dyn Stream<Item=TItem, Error=()>+Send>); impl Clone for DerivedStateData { fn clone(&self) -> DerivedStateData { // TODO: active_streams? unimplemented!() } } impl DerivedStateData { /// /// Creates an entirely new blank derived state data object /// pub fn new(namespace: Arc<Desync<GluonScriptNamespace>>) -> DerivedStateData { DerivedStateData { namespace: namespace, dependencies: HashSet::new(), active_streams: HashMap::new() } } /// /// Retrieves the namespace for this state /// pub fn get_namespace(&self) -> Arc<Desync<GluonScriptNamespace>> { Arc::clone(&self.namespace) } /// /// Returns true if this state has an active stream for the specified symbol /// pub fn has_stream(&self, symbol: FloScriptSymbol) -> bool { self.active_streams.contains_key(&symbol) } /// /// Polls the stream for the specified symbol (returning None if the stream is not running) /// pub fn poll_stream<TStreamItem: 'static>(&mut self, symbol: FloScriptSymbol) -> Option<Poll<Option<TStreamItem>, ()>> { // Attempt to fetch the stream from the list of active streams if let Some(stream) = self.active_streams.get(&symbol) { // Make sure it's a stream of the let mut stream = stream.lock().unwrap(); if let Some(StreamRef(stream)) = stream.downcast_mut::<StreamRef<TStreamItem>>() { // Have an existing stream of this type Some(stream.poll()) } else { // The stream exists but is of the wrong type (we'll return an empty stream in this case) Some(Ok(Async::Ready(None))) } } else { // No stream started yet None } } /// /// Sets the stream for reading the specified symbol /// pub fn set_stream<TStreamItem: 'static>(&mut self, symbol: FloScriptSymbol, stream: Box<dyn Stream<Item=TStreamItem, Error=()>+Send>) { // Store the stream in a StreamRef (this is used so we can cast it back via Any: annoyingly we end up with a box in a box here) let stream = StreamRef(stream); // Insert into the active stream self.active_streams.insert(symbol, Mutex::new(Box::new(stream))); } } impl Debug for DerivedStateData { fn fmt(&self, formatter: &mut Formatter) -> result::Result<(), fmt::Error> { write!(formatter, "DerivedStateData {{ namespace: <>, dependencies: {:?} }}", self.dependencies)?; Ok(()) } } type ResolveFunction<'vm, TValue> = FunctionRef<'vm, fn(UserdataValue<DerivedStateData>) -> (UserdataValue<DerivedStateData>, TValue)>; /// /// Monad representing a state value /// /// A state value carries along with the symbols that were read from. We use this later on to decide /// what to re-evaluate when new data arrives via an input stream. /// #[derive(VmType)] pub struct DerivedState<'vm, TValue> { // Function for resolving the value of the monad resolve: ResolveFunction<'vm, TValue> } // Gluon's codegen doesn't seem quite up to the job of dealing with a structure with a function in it, so we need to manually implement getable/pushable impl<'vm, 'value, TValue> Getable<'vm, 'value> for DerivedState<'vm, TValue> { impl_getable_simple!(); fn from_value(vm: &'vm Thread, value: Variants<'value>) -> Self { // Fetch the data from the value let data = match value.as_ref() { ValueRef::Data(data) => data, other => panic!("Unexpected value while retrieving DerivedState: {:?}", other) }; // Read the fields let resolve = data.lookup_field(vm, "resolve").expect("Cannot find the `resolve` field while retrieving DerivedState"); // Decode into a derived state DerivedState { resolve: ResolveFunction::from_value(vm, resolve) } } } // Similarly, the codegen can't deal with a functionref when generating a pushable item impl<'vm, TValue: 'static+VmType+Sized> Pushable<'vm> for DerivedState<'vm, TValue> where TValue::Type : Sized { fn push(self, context: &mut ActiveThread<'vm>) -> Result<()> { let vm = context.thread(); // Push the field values ResolveFunction::push(self.resolve, context)?; // Turn into a record let field_names = [vm.global_env().intern("resolve")?]; context.context().push_new_record(vm, 1, &field_names)?; Ok(()) } } /// /// Generates the flo.computed.prim extern module for a Gluon VM /// fn load_prim(vm: &Thread) -> Result<ExternModule> { vm.register_type::<DerivedStateData>("flo.computed.prim.DerivedStateData", &[])?; vm.register_type::<DerivedState<A>>("flo.computed.prim.DerivedState", &["a"])?; ExternModule::new(vm, record! { type DerivedState a => DerivedState<A>, type DerivedStateData => DerivedStateData }) } /// /// Generates the flo.computed extern module for a Gluon VM /// pub fn load_flo_computed(vm: &Thread) -> Result<()> { // Add the primitives module import::add_extern_module(&vm, "flo.computed.prim", load_prim); // And the gluon module let flo_computed = include_str!("derived_state.glu"); let mut compiler = Compiler::default(); compiler.load_script(vm, "flo.computed", flo_computed) .map_err(|err| err.emit_string(&compiler.code_map())) .expect("load flo.computed"); Ok(()) } #[cfg(test)] mod test { use super::*; use gluon::*; use gluon::vm::api::*; use gluon::vm::primitives; use futures::future; use futures::stream; use futures::executor; #[test] fn make_type_from_derived_state() { let vm = new_vm(); load_flo_computed(&vm).unwrap(); // Gluon only imports user data types if the corresponding module has previously been imported Compiler::default().run_expr::<()>(&vm, "importfs", "import! std.fs\n()").unwrap(); Compiler::default().run_expr::<()>(&vm, "importcomputed", "import! flo.computed\n()").unwrap(); // IO monad let _some_type = IO::<i32>::make_type(&vm); // DirEntry is defined in the standard gluon library: it illustrates this issue does is not a bug with how DerivedState is declared let _some_type = UserdataValue::<primitives::DirEntry>::make_type(&vm); let _some_type = primitives::DirEntry::make_type(&vm); // Ultimate goal of this test: we should be able to get the type for DerivedState let _some_type = DerivedState::<i32>::make_type(&vm); } #[test] #[should_panic] fn user_data_import_issue_not_fixed() { // Without the import! side-effects on the VM, user data types are missing (if this test starts failing, we should be able to remove the import! above and when loading flo.computed) let vm = new_vm(); let _some_type = UserdataValue::<primitives::DirEntry>::make_type(&vm); } #[test] fn store_and_poll_user_stream() { let namespace = Arc::new(Desync::new(GluonScriptNamespace::new())); let mut derived_state = DerivedStateData::new(Arc::clone(&namespace)); let stream = stream::iter_ok::<_, ()>(vec![1, 2, 3]); let symbol = FloScriptSymbol::new(); derived_state.set_stream(symbol, Box::new(stream)); let first_symbol = future::poll_fn(move || derived_state.poll_stream::<i32>(symbol).unwrap()); let mut first_symbol = executor::spawn(first_symbol); let first_symbol = first_symbol.wait_future().unwrap(); assert!(first_symbol == Some(1)); } #[test] fn wrong_type_produces_empty_stream() { let namespace = Arc::new(Desync::new(GluonScriptNamespace::new())); let mut derived_state = DerivedStateData::new(Arc::clone(&namespace)); let stream = stream::iter_ok::<_, ()>(vec![1, 2, 3]); let symbol = FloScriptSymbol::new(); derived_state.set_stream(symbol, Box::new(stream)); let first_symbol = future::poll_fn(move || derived_state.poll_stream::<f32>(symbol).unwrap()); let mut first_symbol = executor::spawn(first_symbol); let first_symbol = first_symbol.wait_future().unwrap(); assert!(first_symbol == None); } }
use crate::types::Float; use crate::Normal3f; use crate::Vector3f; use std::rc::Rc; #[derive(Clone)] pub struct BSDF { pub eta: Float, pub ns: Normal3f, pub ng: Normal3f, pub ss: Vector3f, pub ts: Vector3f, pub bxdf_count: i32, pub bxdfs: Vec<Rc<BxDF>>, } pub enum BxDFType { Reflection = 1 << 1, Transmission = 1 << 2, Diffuse = 1 << 3, Glossy = 1 << 4, Specular = 1 << 5, All = (1 << 6) - 1, } pub trait BxDF { fn get_type(&self) -> BxDFType; }
use uuid::Uuid; pub fn generate_uuid() -> String { let uuid = Uuid::new_v4().to_hyphenated(); format!("{}", uuid) }
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::{story_manager::StoryManager, utils}, failure::{Error, ResultExt}, fidl_fuchsia_app_discover::{ SessionDiscoverContextRequest, SessionDiscoverContextRequestStream, StoryDiscoverContextRequest, StoryDiscoverContextRequestStream, StoryDiscoverError, SurfaceData, }, fuchsia_async as fasync, fuchsia_syslog::macros::*, futures::prelude::*, parking_lot::Mutex, std::sync::Arc, }; pub async fn run_server( mut stream: SessionDiscoverContextRequestStream, story_manager: Arc<Mutex<StoryManager>>, ) -> Result<(), Error> { while let Some(request) = stream.try_next().await.context("Error running session context")? { match request { SessionDiscoverContextRequest::GetStoryContext { story_id, request, .. } => { let story_context_stream = request.into_stream()?; StoryContextService::new(story_id, story_manager.clone()) .spawn(story_context_stream); } } } Ok(()) } /// The StoryDiscoverContext protocol implementation. pub struct StoryContextService { /// The story id to which the module belongs. story_id: String, story_manager: Arc<Mutex<StoryManager>>, } impl StoryContextService { pub fn new(story_id: impl Into<String>, story_manager: Arc<Mutex<StoryManager>>) -> Self { StoryContextService { story_id: story_id.into(), story_manager } } pub fn spawn(self, mut stream: StoryDiscoverContextRequestStream) { fasync::spawn_local( async move { while let Some(request) = stream .try_next() .await .context(format!("Error running story context for {:?}", self.story_id))? { match request { StoryDiscoverContextRequest::GetSurfaceData { surface_id, responder } => { // TODO: actually return the proper data. let manager_lock = self.story_manager.lock(); let graph_result = manager_lock.get_story_graph(&self.story_id).await; let result = graph_result .as_ref() .and_then(|result| result.get_module_data(&surface_id)); match result { None => { responder.send(SurfaceData { action: None, parameter_types: None, })?; } Some(ref module_data) => { responder.send(SurfaceData { action: module_data.last_intent.action.clone(), // TODO: story_manager still doesn't contain the outputs parameter_types: Some(vec![]), })?; } } } StoryDiscoverContextRequest::SetProperty { key, value, responder } => { let mut story_manager = self.story_manager.lock(); let mut res = story_manager .set_property( &self.story_id, &key, utils::vmo_buffer_to_string(Box::new(value))?, ) .await; responder.send(&mut res)?; } StoryDiscoverContextRequest::GetProperty { key, responder } => { let story_manager = self.story_manager.lock(); let property = story_manager.get_property(&self.story_id, &key).await; responder.send(&mut property.and_then(|content| { utils::string_to_vmo_buffer(content) .map_err(|_| StoryDiscoverError::VmoStringConversion) }))?; } } } Ok(()) } .unwrap_or_else(|e: Error| fx_log_err!("error serving story context {}", e)), ) } } #[cfg(test)] mod tests { use { super::*, crate::{ constants::{GRAPH_KEY, STATE_KEY, TITLE_KEY}, models::AddModInfo, story_manager::StoryManager, story_storage::MemoryStorage, utils, }, fidl_fuchsia_app_discover::{SessionDiscoverContextMarker, StoryDiscoverContextMarker}, fuchsia_async as fasync, }; #[fasync::run_singlethreaded(test)] async fn story_context_get_surface_data() -> Result<(), Error> { // Initialize some fake state. let story_id = "my-story".to_string(); let mod_name = "my-mod".to_string(); let action_name = "my-action".to_string(); let story_manager = Arc::new(Mutex::new(StoryManager::new(Box::new(MemoryStorage::new())))); let mut action = AddModInfo::new_raw( "some-component-url", Some(story_id.clone()), Some(mod_name.clone()), ); action.intent.action = Some(action_name.clone()); { let mut manager_lock = story_manager.lock(); manager_lock.add_to_story_graph(&action, vec![]).await?; } // Initialize service client and server. let (client, request_stream) = fidl::endpoints::create_proxy_and_stream::<SessionDiscoverContextMarker>().unwrap(); fasync::spawn_local( async move { run_server(request_stream, story_manager).await } .unwrap_or_else(|e: Error| eprintln!("error running server {}", e)), ); // Get the story context let (story_context_proxy, server_end) = fidl::endpoints::create_proxy::<StoryDiscoverContextMarker>()?; assert!(client.get_story_context(&story_id, server_end).is_ok()); let surface_data = story_context_proxy.get_surface_data(&mod_name).await?; assert_eq!(surface_data.action, Some(action_name)); assert_eq!(surface_data.parameter_types, Some(vec![])); Ok(()) } #[fasync::run_until_stalled(test)] async fn test_get_set_property() -> Result<(), Error> { let (client, request_stream) = fidl::endpoints::create_proxy_and_stream::<SessionDiscoverContextMarker>().unwrap(); let story_manager_arc = Arc::new(Mutex::new(StoryManager::new(Box::new(MemoryStorage::new())))); let cloned_story_manager_arc = story_manager_arc.clone(); fasync::spawn_local( async move { run_server(request_stream, cloned_story_manager_arc).await } .unwrap_or_else(|e: Error| eprintln!("error running server {}", e)), ); // Get the StoryDiscoverContext connection. let (story_discover_context_proxy, server_end) = fidl::endpoints::create_proxy::<StoryDiscoverContextMarker>()?; assert!(client.get_story_context("story_name", server_end).is_ok()); // Set the title of the story via SetProperty service assert!(story_discover_context_proxy .set_property(TITLE_KEY, &mut utils::string_to_vmo_buffer("new_title")?) .await .is_ok()); // Get the title of the story via GetProperty service let returned_title = utils::vmo_buffer_to_string(Box::new( story_discover_context_proxy.get_property(TITLE_KEY).await?.unwrap(), ))?; // Ensure that set & get all succeed assert_eq!(returned_title, "new_title".to_string()); // Ensure that setting to state/graph is not allowed assert_eq!( story_discover_context_proxy .set_property(STATE_KEY, &mut utils::string_to_vmo_buffer("some-state")?) .await?, Err(StoryDiscoverError::InvalidKey) ); assert_eq!( story_discover_context_proxy .set_property(GRAPH_KEY, &mut utils::string_to_vmo_buffer("some-state")?) .await?, Err(StoryDiscoverError::InvalidKey) ); Ok(()) } }
mod area; mod building; mod bus_stop; mod edits; mod intersection; mod lane; mod make; mod map; mod neighborhood; pub mod osm; mod pathfind; pub mod raw_data; mod road; mod stop_signs; mod traffic_signals; mod traversable; mod turn; pub use crate::area::{Area, AreaID, AreaType}; pub use crate::building::{Building, BuildingID, FrontPath, OffstreetParking}; pub use crate::bus_stop::{BusRoute, BusRouteID, BusStop, BusStopID}; pub use crate::edits::MapEdits; pub use crate::intersection::{Intersection, IntersectionID, IntersectionType}; pub use crate::lane::{Lane, LaneID, LaneType, PARKING_SPOT_LENGTH}; pub use crate::make::RoadSpec; pub use crate::map::Map; pub use crate::neighborhood::{FullNeighborhoodInfo, Neighborhood, NeighborhoodBuilder}; pub use crate::pathfind::{Path, PathRequest, PathStep}; pub use crate::road::{DirectedRoadID, Road, RoadID}; pub use crate::stop_signs::{ControlStopSign, RoadWithStopSign}; pub use crate::traffic_signals::{ControlTrafficSignal, Cycle}; pub use crate::traversable::{Position, Traversable}; pub use crate::turn::{Turn, TurnID, TurnPriority, TurnType}; use abstutil::Cloneable; use geom::Distance; pub const LANE_THICKNESS: Distance = Distance::const_meters(2.5); impl Cloneable for BusRouteID {} impl Cloneable for ControlTrafficSignal {} impl Cloneable for IntersectionID {} impl Cloneable for LaneType {} impl Cloneable for MapEdits {} impl Cloneable for Neighborhood {} impl Cloneable for NeighborhoodBuilder {}
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::GString; use glib_sys; use libc; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; use webkit2_webextension_sys; use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DOMHTMLFormElement; use DOMNode; use DOMObject; glib_wrapper! { pub struct DOMHTMLOptionElement(Object<webkit2_webextension_sys::WebKitDOMHTMLOptionElement, webkit2_webextension_sys::WebKitDOMHTMLOptionElementClass, DOMHTMLOptionElementClass>) @extends DOMHTMLElement, DOMElement, DOMNode, DOMObject, @implements DOMEventTarget; match fn { get_type => || webkit2_webextension_sys::webkit_dom_html_option_element_get_type(), } } pub const NONE_DOMHTML_OPTION_ELEMENT: Option<&DOMHTMLOptionElement> = None; pub trait DOMHTMLOptionElementExt: 'static { #[cfg_attr(feature = "v2_22", deprecated)] fn get_default_selected(&self) -> bool; #[cfg_attr(feature = "v2_22", deprecated)] fn get_disabled(&self) -> bool; #[cfg_attr(feature = "v2_22", deprecated)] fn get_form(&self) -> Option<DOMHTMLFormElement>; #[cfg_attr(feature = "v2_22", deprecated)] fn get_index(&self) -> libc::c_long; #[cfg_attr(feature = "v2_22", deprecated)] fn get_label(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] fn get_selected(&self) -> bool; #[cfg_attr(feature = "v2_22", deprecated)] fn get_text(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] fn get_value(&self) -> Option<GString>; #[cfg_attr(feature = "v2_22", deprecated)] fn set_default_selected(&self, value: bool); #[cfg_attr(feature = "v2_22", deprecated)] fn set_disabled(&self, value: bool); #[cfg_attr(feature = "v2_22", deprecated)] fn set_label(&self, value: &str); #[cfg_attr(feature = "v2_22", deprecated)] fn set_selected(&self, value: bool); #[cfg_attr(feature = "v2_22", deprecated)] fn set_value(&self, value: &str); fn connect_property_default_selected_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId; fn connect_property_disabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_form_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; } impl<O: IsA<DOMHTMLOptionElement>> DOMHTMLOptionElementExt for O { fn get_default_selected(&self) -> bool { unsafe { from_glib( webkit2_webextension_sys::webkit_dom_html_option_element_get_default_selected( self.as_ref().to_glib_none().0, ), ) } } fn get_disabled(&self) -> bool { unsafe { from_glib( webkit2_webextension_sys::webkit_dom_html_option_element_get_disabled( self.as_ref().to_glib_none().0, ), ) } } fn get_form(&self) -> Option<DOMHTMLFormElement> { unsafe { from_glib_none( webkit2_webextension_sys::webkit_dom_html_option_element_get_form( self.as_ref().to_glib_none().0, ), ) } } fn get_index(&self) -> libc::c_long { unsafe { webkit2_webextension_sys::webkit_dom_html_option_element_get_index( self.as_ref().to_glib_none().0, ) } } fn get_label(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_option_element_get_label( self.as_ref().to_glib_none().0, ), ) } } fn get_selected(&self) -> bool { unsafe { from_glib( webkit2_webextension_sys::webkit_dom_html_option_element_get_selected( self.as_ref().to_glib_none().0, ), ) } } fn get_text(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_option_element_get_text( self.as_ref().to_glib_none().0, ), ) } } fn get_value(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_option_element_get_value( self.as_ref().to_glib_none().0, ), ) } } fn set_default_selected(&self, value: bool) { unsafe { webkit2_webextension_sys::webkit_dom_html_option_element_set_default_selected( self.as_ref().to_glib_none().0, value.to_glib(), ); } } fn set_disabled(&self, value: bool) { unsafe { webkit2_webextension_sys::webkit_dom_html_option_element_set_disabled( self.as_ref().to_glib_none().0, value.to_glib(), ); } } fn set_label(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_option_element_set_label( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } fn set_selected(&self, value: bool) { unsafe { webkit2_webextension_sys::webkit_dom_html_option_element_set_selected( self.as_ref().to_glib_none().0, value.to_glib(), ); } } fn set_value(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_option_element_set_value( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } fn connect_property_default_selected_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_default_selected_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLOptionElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLOptionElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::default-selected\0".as_ptr() as *const _, Some(transmute( notify_default_selected_trampoline::<Self, F> as usize, )), Box_::into_raw(f), ) } } fn connect_property_disabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_disabled_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLOptionElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLOptionElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::disabled\0".as_ptr() as *const _, Some(transmute(notify_disabled_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_form_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_form_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLOptionElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLOptionElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::form\0".as_ptr() as *const _, Some(transmute(notify_form_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_index_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLOptionElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLOptionElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::index\0".as_ptr() as *const _, Some(transmute(notify_index_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_label_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLOptionElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLOptionElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::label\0".as_ptr() as *const _, Some(transmute(notify_label_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLOptionElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLOptionElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::selected\0".as_ptr() as *const _, Some(transmute(notify_selected_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_text_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLOptionElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLOptionElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::text\0".as_ptr() as *const _, Some(transmute(notify_text_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMHTMLOptionElement, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMHTMLOptionElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::value\0".as_ptr() as *const _, Some(transmute(notify_value_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } } impl fmt::Display for DOMHTMLOptionElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "DOMHTMLOptionElement") } }
//! The relocation package provide two structures: RelocSink, TrapSink. //! This structures are used by Cranelift when compiling functions to mark //! any other calls that this function is doing, so we can "patch" the //! function addrs in runtime with the functions we need. use cranelift_codegen::binemit; pub use cranelift_codegen::binemit::Reloc; use cranelift_codegen::ir::{self, ExternalName, LibCall, SourceLoc, TrapCode}; use hashbrown::HashMap; use wasmer_runtime_core::{structures::TypedIndex, types::LocalFuncIndex}; pub mod call_names { pub const LOCAL_NAMESPACE: u32 = 1; pub const IMPORT_NAMESPACE: u32 = 2; pub const STATIC_MEM_GROW: u32 = 0; pub const STATIC_MEM_SIZE: u32 = 1; pub const SHARED_STATIC_MEM_GROW: u32 = 2; pub const SHARED_STATIC_MEM_SIZE: u32 = 3; pub const DYNAMIC_MEM_GROW: u32 = 4; pub const DYNAMIC_MEM_SIZE: u32 = 5; } #[derive(Debug, Clone)] pub struct Relocation { /// The relocation code. pub reloc: binemit::Reloc, /// The offset where to apply the relocation. pub offset: binemit::CodeOffset, /// The addend to add to the relocation value. pub addend: binemit::Addend, /// Relocation type. pub target: RelocationType, } #[derive(Debug, Clone, Copy)] pub enum VmCallKind { StaticMemoryGrow, StaticMemorySize, SharedStaticMemoryGrow, SharedStaticMemorySize, DynamicMemoryGrow, DynamicMemorySize, } #[derive(Debug, Clone, Copy)] pub enum VmCall { Local(VmCallKind), Import(VmCallKind), } /// Specify the type of relocation #[derive(Debug, Clone)] pub enum RelocationType { Normal(LocalFuncIndex), Intrinsic(String), LibCall(LibCall), VmCall(VmCall), } /// Implementation of a relocation sink that just saves all the information for later pub struct RelocSink { /// Relocations recorded for the function. pub func_relocs: Vec<Relocation>, } impl binemit::RelocSink for RelocSink { fn reloc_ebb( &mut self, _offset: binemit::CodeOffset, _reloc: binemit::Reloc, _ebb_offset: binemit::CodeOffset, ) { // This should use the `offsets` field of `ir::Function`. unimplemented!(); } fn reloc_external( &mut self, offset: binemit::CodeOffset, reloc: binemit::Reloc, name: &ExternalName, addend: binemit::Addend, ) { match *name { ExternalName::User { namespace: 0, index, } => { self.func_relocs.push(Relocation { reloc, offset, addend, target: RelocationType::Normal(LocalFuncIndex::new(index as usize)), }); } ExternalName::User { namespace, index } => { use self::call_names::*; let target = RelocationType::VmCall(match namespace { LOCAL_NAMESPACE => VmCall::Local(match index { STATIC_MEM_GROW => VmCallKind::StaticMemoryGrow, STATIC_MEM_SIZE => VmCallKind::StaticMemorySize, SHARED_STATIC_MEM_GROW => VmCallKind::SharedStaticMemoryGrow, SHARED_STATIC_MEM_SIZE => VmCallKind::SharedStaticMemorySize, DYNAMIC_MEM_GROW => VmCallKind::DynamicMemoryGrow, DYNAMIC_MEM_SIZE => VmCallKind::DynamicMemorySize, _ => unimplemented!(), }), IMPORT_NAMESPACE => VmCall::Import(match index { STATIC_MEM_GROW => VmCallKind::StaticMemoryGrow, STATIC_MEM_SIZE => VmCallKind::StaticMemorySize, SHARED_STATIC_MEM_GROW => VmCallKind::SharedStaticMemoryGrow, SHARED_STATIC_MEM_SIZE => VmCallKind::SharedStaticMemorySize, DYNAMIC_MEM_GROW => VmCallKind::DynamicMemoryGrow, DYNAMIC_MEM_SIZE => VmCallKind::DynamicMemorySize, _ => unimplemented!(), }), _ => unimplemented!(), }); self.func_relocs.push(Relocation { reloc, offset, addend, target, }); } ExternalName::TestCase { length, ascii } => { let (slice, _) = ascii.split_at(length as usize); let name = String::from_utf8(slice.to_vec()).unwrap(); self.func_relocs.push(Relocation { reloc, offset, addend, target: RelocationType::Intrinsic(name), }); } ExternalName::LibCall(libcall) => { let relocation_type = RelocationType::LibCall(libcall); self.func_relocs.push(Relocation { reloc, offset, addend, target: relocation_type, }); } } } fn reloc_jt( &mut self, _offset: binemit::CodeOffset, _reloc: binemit::Reloc, _jt: ir::JumpTable, ) { unimplemented!(); } } /// Implementation of a relocation sink that just saves all the information for later impl RelocSink { pub fn new() -> RelocSink { RelocSink { func_relocs: Vec::new(), } } } #[derive(Debug, Clone, Copy)] pub struct TrapData { pub trapcode: TrapCode, pub srcloc: SourceLoc, } /// Simple implementation of a TrapSink /// that saves the info for later. pub struct TrapSink { trap_datas: HashMap<usize, TrapData>, } impl TrapSink { pub fn new() -> TrapSink { TrapSink { trap_datas: HashMap::new(), } } pub fn lookup(&self, offset: usize) -> Option<TrapData> { self.trap_datas.get(&offset).cloned() } pub fn drain_local(&mut self, current_func_offset: usize, local: &mut LocalTrapSink) { local.trap_datas.drain(..).for_each(|(offset, trap_data)| { self.trap_datas .insert(current_func_offset + offset, trap_data); }); } } pub struct LocalTrapSink { trap_datas: Vec<(usize, TrapData)>, } impl LocalTrapSink { pub fn new() -> Self { LocalTrapSink { trap_datas: vec![] } } } impl binemit::TrapSink for LocalTrapSink { fn trap(&mut self, offset: u32, srcloc: SourceLoc, trapcode: TrapCode) { self.trap_datas .push((offset as usize, TrapData { trapcode, srcloc })); } }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type SpatialSurfaceInfo = *mut ::core::ffi::c_void; pub type SpatialSurfaceMesh = *mut ::core::ffi::c_void; pub type SpatialSurfaceMeshBuffer = *mut ::core::ffi::c_void; pub type SpatialSurfaceMeshOptions = *mut ::core::ffi::c_void; pub type SpatialSurfaceObserver = *mut ::core::ffi::c_void;
#[cfg(feature = "v2")] use crate::v2::models::{DataType, ParameterIn}; use thiserror::Error; /// Errors related to spec validation. #[derive(Debug, Error)] pub enum ValidationError { /// Failed to resolve the schema because an invalid URI was provided for /// `$ref` field. /// /// Currently, we only support `#/{definitions,parameters}/Name` in `$ref` field. #[error("Invalid $ref URI {:?}. Only relative URIs are supported.", _0)] InvalidRefUri(String), /// The specified reference is missing in the spec. #[error("Reference missing in spec: {}", _0)] MissingReference(String), /// If a parameter specifies body, then schema must be specified. #[error( "Parameter {:?} in path {:?} is a body but the schema is missing", _0, _1 )] MissingSchemaForBodyParameter(String, String), /// Some headers have special meaning in OpenAPI. The user cannot have these headers /// in their API spec. #[error("Path {:?} has header parameter {:?} which is not allowed", _1, _0)] InvalidHeader(String, String), #[cfg(feature = "v2")] /// Only arrays and primitive types are allowed in parameters. #[error( "Parameter {:?} in path {:?} has specified {:?} type, but it's invalid for {:?} parameters", _0, _1, _2, _3 )] InvalidParameterType(String, String, Option<DataType>, ParameterIn), }
use crate::{board_logic::*, console_display::*, *}; #[test] fn it_translates() { assert_eq!(to_coords("a5".to_string()).unwrap(), (0, 4)); assert_eq!(to_notation((0, 4)).unwrap(), ("a5")); } #[test] #[should_panic(expected = "Tried to add piece at non-empty space at (0, 0)")] fn occupied_spot() { let mut board: ChessBoard = init_board(); board.standard_pieces(Color::White); board.standard_pieces(Color::Black); print_board(board.ref_board()); board.add_piece(piece_make(Color::Black, PieceType::Pawn), (0, 0)); } #[test] fn pawn_moves() { let mut board: ChessBoard = init_board(); board.standard_pieces(Color::White); board.standard_pieces(Color::Black); board.force_move((4, 6), (4, 2)).expect("force_move panic"); print_board(board.ref_board()); let mut moves = board.regular_moves((3, 1)); moves.push(board.special_moves((3, 1)).pop().unwrap().0); assert_eq!(moves, vec![(3, 2), (4, 2), (3, 3)]) } #[test] fn passant() { let mut board: ChessBoard = init_board(); board.standard_pieces(Color::White); board.standard_pieces(Color::Black); board.force_move((4, 6), (4, 3)).expect("force_move panic"); print_board(board.ref_board()); board.move_piece((3, 1), (3, 3)).unwrap(); print_board(board.ref_board()); for mov in board.get_moves((4, 3)) { println!("{:?}", mov.0); } board.move_piece((4, 3), (3, 2)).unwrap(); print_board(board.ref_board()); } #[test] fn continous_moves() { let mut board: ChessBoard = init_board(); board.standard_pieces(Color::White); board.standard_pieces(Color::Black); board.force_move((3, 1), (3, 3)).expect("force_move panic"); board.force_move((3, 0), (3, 1)).expect("force_move panic"); print_board(board.ref_board()); let mut queen_moves = vec![ (0, 4), (1, 3), (2, 2), (3, 2), (3, 0), (4, 2), (5, 3), (6, 4), (7, 5), ]; queen_moves.sort(); let mut moves = board.regular_moves((3, 1)); moves.sort(); assert_eq!(queen_moves, moves) } #[test] fn castling() { let mut board: ChessBoard = init_board(); board.add_piece(piece_make(Color::White, PieceType::King), (4, 0)); board.add_piece(piece_make(Color::White, PieceType::Knight), (3, 0)); board.add_piece(piece_make(Color::White, PieceType::Pawn), (3, 1)); board.add_piece(piece_make(Color::White, PieceType::Rook), (7, 0)); board.add_piece(piece_make(Color::White, PieceType::Rook), (0, 0)); board.standard_pieces(Color::Black); board.force_move((0, 7), (3, 5)).expect("force_move panic"); print_board(board.ref_board()); assert_eq!(board.special_moves((4, 0)).len(), 1); board.force_move((3, 0), (6, 1)).expect("force_move panic"); print_board(board.ref_board()); assert_eq!(board.special_moves((4, 0)).len(), 2); board.force_move((3, 1), (6, 0)).expect("force_move panic"); print_board(board.ref_board()); assert_eq!(board.special_moves((4, 0)).len(), 0); board.force_move((6, 0), (6, 2)).expect("force_move panic"); print_board(board.ref_board()); assert_eq!(board.special_moves((4, 0)).len(), 1); } #[test] fn finds_checked() { let mut board: ChessBoard = init_board(); board.add_piece(piece_make(Color::White, PieceType::King), (3, 0)); board.add_piece(piece_make(Color::Black, PieceType::Rook), (3, 3)); print_board(board.ref_board()); assert_eq!(true, board.is_checked(Color::White)) } #[test] fn does_promotion() { let mut board: ChessBoard = init_board(); board.add_piece(piece_make(Color::White, PieceType::King), (0, 0)); board.add_piece(piece_make(Color::Black, PieceType::Pawn), (3, 1)); if board .move_piece((3, 1), (3, 0)) .unwrap() .contains("Promotion") { board.promote((3, 0), PieceType::Queen).unwrap(); } print_board(board.ref_board()); assert_eq!(true, board.is_checked(Color::White)) } #[test] fn self_check() { let mut board: ChessBoard = init_board(); board.add_piece(piece_make(Color::White, PieceType::King), (3, 0)); board.add_piece(piece_make(Color::White, PieceType::Knight), (3, 1)); board.add_piece(piece_make(Color::Black, PieceType::Pawn), (1, 2)); board.add_piece(piece_make(Color::Black, PieceType::Rook), (3, 3)); print_board(board.ref_board()); assert_eq!(0, board.get_moves((3, 1)).len()) } #[test] fn check_mate() { let mut board: ChessBoard = init_board(); board.add_piece(piece_make(Color::White, PieceType::King), (7, 7)); board.add_piece(piece_make(Color::Black, PieceType::Knight), (5, 5)); board.add_piece(piece_make(Color::Black, PieceType::Rook), (7, 6)); print_board(board.ref_board()); assert_eq!(true, board.self_check((7, 7), (6, 6))); assert_eq!(true, board.is_checkmate(Color::White)); let mut board2: ChessBoard = init_board(); board2.standard_pieces(Color::Black); board2.standard_pieces(Color::White); board2.force_move((5, 1), (5, 2)).expect("force_move panic"); board2.force_move((4, 6), (4, 4)).expect("force_move panic"); print_board(board2.ref_board()); assert_eq!(false, board2.is_checkmate(Color::White)); board2.force_move((6, 1), (6, 3)).expect("force_move panic"); board2.force_move((3, 7), (7, 3)).expect("force_move panic"); print_board(board2.ref_board()); assert_eq!(true, board2.is_checkmate(Color::White)) } #[test] fn finds_mov() { let mut board: ChessBoard = init_board(); board.standard_pieces(Color::White); board.standard_pieces(Color::Black); board.force_move((3, 1), (3, 3)).expect("force_move panic"); board.force_move((3, 0), (3, 1)).expect("force_move panic"); print_board(board.ref_board()); let mut queen_moves = vec![ (0, 4), (1, 3), (2, 2), (3, 2), (3, 0), (4, 2), (5, 3), (6, 4), (7, 5), ]; queen_moves.sort(); let mut movs = board.get_moves((3, 1)); movs.retain(|(mov, _)| *mov == (1, 3)); for (mov, special) in movs { println!("{:?} {}", mov, { special == None }); } }
// Copyright (c) 2020 DarkWeb Design // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. /// Apply a user supplied function to every member of a vector /// /// # Description /// /// Applies the user-defined callback function to each element of the vector. /// /// **callback** /// /// Callback takes on two parameters. The vector parameter's value being the first, and the index /// second. /// /// Only the values of the vector may potentially be changed, i.e., the programmer cannot add, unset /// or reorder elements. /// /// # Examples /// /// Example #1 array_walk() example /// /// ``` /// use phpify::array::array_walk; /// /// let mut fruits = vec![ /// "lemon".to_string(), /// "orange".to_string(), /// "banana".to_string(), /// "apple".to_string(), /// ]; /// /// fn test_alter(item: &mut String, index: usize) { /// *item = format!("fruit: {}", *item); /// } /// /// array_walk(&mut fruits, test_alter); /// /// assert_eq!(fruits[0], "fruit: lemon"); /// assert_eq!(fruits[1], "fruit: orange"); /// assert_eq!(fruits[2], "fruit: banana"); /// assert_eq!(fruits[3], "fruit: apple"); /// ``` pub fn array_walk<T>(array: &mut Vec<T>, callback: impl Fn(&mut T, usize) + 'static) { for (index, value) in array.iter_mut().enumerate() { callback(value, index); } } #[cfg(test)] mod tests { use crate::array::array_walk; #[test] fn test() { let mut vec = vec![1, 2, 3]; array_walk(&mut vec, |value, index| *value = *value * index); assert_eq!(vec, [0, 2, 6]); } }
use game::*; impl Suppressable{ pub fn default(mover_id: MoverID)->Suppressable{ Suppressable{ mover_id: mover_id, voluntary_xspeed: 0.0, voluntary_yspeed: 0.0, involuntary_forces: Vec::new(), stunned_for: 0, disabled_for: 0 } } pub fn remove(game: &mut Game1, id: SuppressableID){ game.suppressables.remove(id.id); } } pub fn step_suppressables(game: &mut Game1){ for suppressable in game.suppressables.iter_mut(){ let mover=game.movers.at_mut(suppressable.mover_id.id); if mover.disabled {continue} mover.xspeed=0.0; mover.yspeed=0.0; let mut jerked=suppressable.involuntary_forces.len()>0; let mut kept_forces=Vec::new(); for (time, xspeed, yspeed) in suppressable.involuntary_forces.drain(..){ mover.xspeed+=xspeed; mover.yspeed+=yspeed; if time>1 {kept_forces.push((time-1, xspeed, yspeed));} } if suppressable.stunned_for>0 {suppressable.stunned_for-=1; jerked=true;} if suppressable.disabled_for>0 {println!("Disabled for {}", suppressable.disabled_for); suppressable.disabled_for-=1; jerked=true;} if jerked {continue} mover.xspeed+=suppressable.voluntary_xspeed; mover.yspeed+=suppressable.voluntary_yspeed; } }
use crate::raycasting::ray::HitPoint; use crate::raycasting::ray::Ray; use crate::types::{Vector3f}; use crate::geom::rand_geom::random_in_unit_sphere; use dyn_clone::{clone_trait_object, DynClone}; pub trait Material : Send + Sync + DynClone { fn scatter (&self, ray: &Ray, rec: &HitPoint) -> Option<(Vector3f, Ray)>; } dyn_clone::clone_trait_object!(Material); #[derive(Clone)] pub struct Lambertian { albedo : Vector3f } impl Lambertian { pub fn new(albedo: Vector3f) -> Lambertian { Lambertian{albedo} } } impl Material for Lambertian { fn scatter (&self, ray: &Ray, rec: &HitPoint)-> Option<(Vector3f, Ray)> { let scatter_direction = rec.normal + random_in_unit_sphere(); let scattered = Ray{origin: rec.position, direction: scatter_direction}; let attenuation = self.albedo; Some((attenuation, scattered)) } } #[derive(Clone)] pub struct Metal { albedo : Vector3f, fuzziness: f32, } impl Metal { pub fn new(albedo: Vector3f, fuzziness: f32) -> Metal { assert!(fuzziness >= 0f32 && fuzziness <= 1.0f32); Metal{albedo, fuzziness} } } fn reflect(v: &Vector3f, n: &Vector3f) -> Vector3f { return v - 2f32*(v.dot(n)*n); } fn refract(uv: &Vector3f, n: &Vector3f, etai_over_etat: f32) -> Vector3f { let cos_theta = (-uv).dot(n); let r_out_perp: Vector3f = etai_over_etat * (uv + cos_theta * n); let r_out_parallel = -(1.0- r_out_perp.magnitude_squared()).abs().sqrt() * n; let r_out = r_out_perp + r_out_parallel; r_out } // vec3 refract(const vec3& uv, const vec3& n, double etai_over_etat) { // auto cos_theta = dot(-uv, n); // vec3 r_out_perp = etai_over_etat * (uv + cos_theta*n); // vec3 r_out_parallel = -sqrt(fabs(1.0 - r_out_perp.length_squared())) * n; // return r_out_perp + r_out_parallel; // } impl Material for Metal { fn scatter (&self, ray: &Ray, rec: &HitPoint)-> Option<(Vector3f, Ray)> { let reflected : Vector3f = reflect(&ray.direction.normalize(), &rec.normal); let scattered_direction = reflected + self.fuzziness * random_in_unit_sphere(); let scattered = Ray{origin: rec.position, direction: scattered_direction}; let attenuation = self.albedo; let scatter_same_normal_direction = scattered.direction.dot(&rec.normal) > 0f32; if scatter_same_normal_direction { Some((attenuation, scattered)) } else { None } } } #[derive(Clone)] pub struct Dielectric { reflective_index: f32 } impl Dielectric { pub fn new(reflective_index: f32) -> Dielectric { Dielectric{reflective_index} } } impl Material for Dielectric { fn scatter (&self, ray: &Ray, rec: &HitPoint)-> Option<(Vector3f, Ray)> { let attenuation = Vector3f::new(1.0, 1.0, 1.0); let etai_over_etat = if rec.front_face { 1.0 / self.reflective_index } else {self.reflective_index}; let unit_direction = ray.direction.normalize(); let refracted = refract(&unit_direction, &rec.normal, etai_over_etat); let scattered = Ray{origin: rec.position, direction: refracted}; Some((attenuation, scattered)) } }
use sdl2::rect::{Rect}; use sdl2::pixels::Color; use sdl2::render::{WindowCanvas, Texture}; use crate::Constants; #[derive(Copy, Clone)] pub struct Tile { pub rect: Rect, pub color: Color, pub selected: bool } impl Tile { pub fn new( x: i32, y: i32, passed:Color ) -> Tile { Tile { rect: Rect::new( x, y,Constants::TILE_SIZE,Constants::TILE_SIZE), color: passed, selected: false } } } //yanks out the last digit and replaces with a zero fn flatten( num: i32 ) -> i32 { if num < 80 { return 0; } let mut n = num; n = n - (n % Constants::TILE_SIZE as i32); return n; } //finds the index for the tile based on coords pub fn find_grid_index( x: i32, y:i32, canvas_width: u32, canvas_height: u32 ) -> usize { let xcoord = flatten( x ); let ycoord = flatten( y ); let row_index = xcoord / Constants::TILE_SIZE as i32; let col_index = ycoord / Constants::TILE_SIZE as i32; println!( "row idx = {} col idx = {}", row_index, col_index ); let r: usize = ((row_index * Constants::NUM_OF_TILES_ROW as i32) + col_index) as usize; r } pub fn draw_grid(canvas: &mut WindowCanvas, h: u32, w: u32 ) -> Vec<Tile> { let mut tiles = Vec::with_capacity( Constants::NUM_OF_TILES_ROW * Constants::NUM_OF_TILES_COL); canvas.clear(); for i in 0..Constants::NUM_OF_TILES_COL { for j in 0..Constants::NUM_OF_TILES_ROW { //if i == 10 && j == 11 { // color = Color::RGB( 0, 0, 255 ); // println!( " correct idx = {}", j + (i*NUM_OF_TILES_ROW) ); // println!("X = {} Y = {}", i * TILE_SIZE as usize, j * TILE_SIZE as usize); //} tiles.push(Tile::new(i as i32 * Constants::TILE_SIZE as i32 , j as i32 * Constants::TILE_SIZE as i32, Constants::get_background_line_color() )); canvas.set_draw_color( Constants::get_background_line_color() ); canvas.draw_rect( tiles[j + (i*Constants::NUM_OF_TILES_ROW) ].rect ); canvas.present(); } } tiles }
use std::vec::Vec; use std::string::String; use std::collections::{HashSet, HashMap}; use std::{thread, time}; use std::cell::RefCell; use std::error::Error; use std::fs::File; use std::io::BufReader; use std::path::Path; use thirtyfour_sync::prelude::*; use serde::Deserialize; use serde_json::Value; use lettre::transport::smtp::authentication::Credentials; use lettre::{Message, SmtpTransport, Transport}; use log; #[derive(Deserialize)] pub struct Config { url: String, login_email: String, login_password: String, notify_username: String, notify_password: String } impl Config { pub fn new(path: &str) -> Config { // Open the file in read-only mode with buffer. let file = File::open("config/settings.json").expect("Error openenign file"); let reader = BufReader::new(file); // Read the JSON contents of the file as an instance of `User`. let u = serde_json::from_reader(reader).expect("Error when parsing json"); u } fn get_url(&self) -> &str { &self.url } fn get_login_email(&self) -> &str { &self.login_email } fn get_login_password(&self) -> &str { &self.login_password } fn get_notify_username(&self) -> &str { &self.notify_username } fn get_notify_password(&self) -> &str { &self.notify_password } } pub struct ReservationInfo { // { // Location: // { // Date: [Email] // } // } inner: HashMap<String, HashMap<String, Vec<String>>> } impl ReservationInfo { pub fn new(path: &str) -> ReservationInfo { let mut inner: HashMap<String, HashMap<String, Vec<String>>> = HashMap::new(); let file = File::open("config/info.json").expect("Error openenign file"); let reader = BufReader::new(file); // Read the JSON contents of the file as an instance of `User`. let v: Value = serde_json::from_reader(reader).expect("Error when parsing json"); match(v) { Value::Object(email_map) => { for email in email_map.keys() { let object = email_map.get(email).unwrap(); match(object) { Value::Object(location_map) => { for location in location_map.keys() { let dates = location_map.get(location).unwrap().as_array().expect("Should be an array"); for date in dates.iter() { let date = date.as_str().unwrap().to_string(); if (inner.contains_key(location)){ let day_map = inner.get_mut(location).unwrap(); if (day_map.contains_key(&date)) { day_map.get_mut(&date).unwrap().push(email.clone()); } else { day_map.insert(date, vec![email.clone()]); } } else { let mut intermediate = HashMap::new(); intermediate.insert(date, vec![email.clone()]); inner.insert(location.clone(), intermediate); } } } }, _ => panic!("should have been an object") } } }, _ => panic!("should have been an object") } ReservationInfo { inner } } pub fn get_locations(&self) -> Vec<&String> { self.inner.keys().collect() } pub fn get_dates(&self, location: &str) -> Vec<&String> { // TODO: change the return type to a set self.inner.get(location).unwrap().keys().collect() } pub fn get_emails(&self, location: &str, date: &str) -> &Vec<String> { self.inner.get(location).unwrap().get(date).unwrap() } } pub struct PowSniper { driver: WebDriver, config: Config, reservations: ReservationInfo, current_available: RefCell<HashSet<String>> } impl PowSniper { pub fn new(driver_url: &str, config: Config, reservations: ReservationInfo) -> WebDriverResult<PowSniper> { let caps = DesiredCapabilities::chrome(); let driver = WebDriver::new(driver_url, &caps)?; let current_available = RefCell::new(HashSet::new()); Ok(PowSniper { driver, config, reservations, current_available }) } pub fn run(&self) -> WebDriverResult<()> { self.login(); let wait = time::Duration::from_secs(30); let locations = self.reservations.get_locations(); loop { for location in locations.iter() { log::debug!("Running... Checking {}", location); self.click_reservation_button()?; self.navigate_to_reservation_page(location)?; self.monitor_availability(location)?; self.redirect()?; } thread::sleep(wait); } Ok(()) } fn login(&self) -> WebDriverResult<()> { self.driver.get(self.config.get_url())?; let email_input = self.driver.find_element(By::Id("email"))?; let password_input = self.driver.find_element(By::Id("sign-in-password"))?; email_input.send_keys(self.config.get_login_email())?; password_input.send_keys(TypingData::from(self.config.get_login_password()) + Keys::Return)?; Ok(()) } fn click_reservation_button(&self) -> WebDriverResult<()> { let reservation_button = self.driver.find_element(By::XPath("//*[@id=\"root\"]/div/div/main/section[1]/div/div[1]/div/a"))?; reservation_button.click()?; Ok(()) } fn navigate_to_reservation_page(&self, location: &str) -> WebDriverResult<()> { let location_search = self.driver.find_element(By::XPath("//*[@id=\"root\"]/div/div/main/section[2]/div/div[2]/div[2]/div[1]/div[1]/div/div/div[1]/input"))?; location_search.send_keys(location)?; self.driver.find_element(By::XPath("//*[@id=\"react-autowhatever-resort-picker-section-0-item-0\"]"))?.click()?; self.driver.find_element(By::XPath("//*[@id=\"root\"]/div/div/main/section[2]/div/div[2]/div[2]/div[2]/button"))?.click()?; Ok(()) } fn monitor_availability(&self, location: &str) -> WebDriverResult<()> { // checks this month and the current month's days for i in 0..3 { if i != 0 { self.driver.find_element(By::XPath("//*[@id=\"root\"]/div/div/main/section[2]/div/div[2]/div[3]/div[1]/div[1]/div[1]/div/div[1]/div[2]/button[2]"))?.click()?; } let days = self.driver.find_elements(By::ClassName("DayPicker-Day"))?; for day in days.iter() { let curr_class = day.get_attribute("class")?.expect("No attribute named 'class'"); let raw_available_date = day.get_attribute("aria-label")?.expect("No attribute named 'aria-label'"); let split_dates: Vec<&str> = raw_available_date.split(' ').collect(); let available_date = &split_dates[1..3].join(" "); let val = available_date.to_string() + location; if curr_class == "DayPicker-Day" { // if the val isn't in the set then send notifications if it's a day of interest if self.current_available.borrow_mut().insert(val.clone()) { for &date in self.reservations.get_dates(location).iter() { if date == available_date { // if the val isn't in the set, this is a new availability and thus // notifications should be sent let emails = self.reservations.get_emails(location, date); for email in emails.iter() { self.notify(email, location, date); if email != "jjohnson473@gatech.edu" { self.notify("jjohnson473@gatech.edu", location, date); } } } } } } else { self.current_available.borrow_mut().remove(&val); } } } Ok(()) } fn notify(&self, email: &str, location: &str, date: &str) -> WebDriverResult<()> { let url = "https://account.ikonpass.com/en/myaccount/add-reservations/"; let email = Message::builder() .from(format!("Ikon Pass Reservations <{}@gmail.com>", self.config.get_notify_username()).parse().unwrap()) .to(format!("<{}>", email).parse().unwrap()) .subject(format!("{} Reservation", location)) .body(format!("{} at {} is now available!\n Click the link below to reserve your spot:\n {}", date, location, url)) .unwrap(); let creds = Credentials::new(self.config.get_notify_username().to_string(), self.config.get_notify_password().to_string()); // Open a remote connection to gmail let mailer = SmtpTransport::relay("smtp.gmail.com") .unwrap() .credentials(creds) .build(); // Send the email match mailer.send(&email) { Ok(_) => log::info!("Email sent successfully!"), Err(e) => log::error!("Could not send email: {:?}", e), } Ok(()) } fn redirect(&self) -> WebDriverResult<()> { self.driver.get(self.config.get_url()) } }
use self_cell::self_cell; type Dep1<'a> = (&'a str, &'static str); self_cell! { pub struct Struct1 { owner: String, #[covariant] dependent: Dep1, } } type Dep2<'a> = (&'static str, &'a str); self_cell! { pub struct Struct2 { owner: String, #[covariant] dependent: Dep2, } } fn main() { let hello: &'static str; { let mut x1 = Struct1::new(String::from("Hello World"), |s| (s, "")); let mut x2 = Struct2::new(String::new(), |_| ("", "")); std::mem::swap(&mut x1.unsafe_self_cell, &mut x2.unsafe_self_cell); hello = x2.borrow_dependent().0; dbg!(hello); // "Hello World" // hello is now a static reference in to the "Hello World" string } // the String is dropped at the end of the block above dbg!(hello); // prints garbage, use-after-free }
#![feature(proc_macro_span)] extern crate peg; extern crate proc_macro; use std::fs; use std::iter; use proc_macro::{ TokenStream, TokenTree, Span, Delimiter }; #[proc_macro] pub fn peg(input: TokenStream) -> TokenStream { let (name, source, span) = parse_peg_args(input); let line = span.start().line; let fname = span.source_file().path().display().to_string(); // Make PEG line numbers match source line numbers let source = iter::repeat('\n').take(line - 1).collect::<String>() + &source; expand_peg(name, fname, source) } /// Parse a TokenStream of the form `name r#""#` fn parse_peg_args(input: TokenStream) -> (String, String, Span) { let mut iter = input.into_iter(); let name = match iter.next() { Some(TokenTree::Ident(i)) => i.to_string(), Some(other) => panic!("Expected grammar name, found {}", other), None => panic!("Unexpected end of macro input") }; let (body_literal, span) = match iter.next() { Some(TokenTree::Literal(l)) => (l.to_string(), l.span()), Some(other) => panic!("Expected raw string literal, found {}", other), None => panic!("Unexpected end of macro input") }; if !body_literal.starts_with("r#\"") || !body_literal.ends_with("\"#") { panic!("Expected raw string literal (`r#\"...\"#`)"); } let body_string = body_literal[3..body_literal.len()-2].to_string(); match iter.next() { None => {} Some(_) => panic!("Unexpected trailing tokens in macro") } (name, body_string, span) } #[proc_macro] pub fn peg_file(input: TokenStream) -> TokenStream { let (name, fname, span) = parse_peg_file_args(input); if !span.source_file().is_real() { panic!("Can't resolve path relative to {:?}", span.source_file().path()); } let caller_path = span.source_file().path(); let source_path = caller_path.parent().unwrap().join(&fname); let source = fs::read_to_string(source_path).expect("Error reading file"); expand_peg(name, fname, source) } /// Parse a TokenStream of the form `name("filename")` fn parse_peg_file_args(input: TokenStream) -> (String, String, Span) { let mut iter = input.into_iter(); let name = match iter.next() { Some(TokenTree::Ident(i)) => i.to_string(), Some(other) => panic!("Expected grammar name, found {}", other), None => panic!("Unexpected end of macro input") }; let (mut body_iter, span) = match iter.next() { Some(TokenTree::Group(ref g)) if g.delimiter() == Delimiter::Parenthesis => (g.stream().into_iter(), g.span()), Some(other) => panic!("Expected parenthesis, found {}", other), None => panic!("Unexpected end of macro input") }; let body_literal = match body_iter.next() { Some(TokenTree::Literal(l)) => l.to_string(), Some(other) => panic!("Expected string literal, found {}", other), None => panic!("Expected file name") }; if !body_literal.starts_with("\"") || !body_literal.ends_with("\"") { panic!("Expected string literal"); } if body_literal.contains("\\") { panic!("Unsupported string escape"); } let body_string = body_literal[1..body_literal.len()-1].to_string(); match iter.next() { None => {} Some(_) => panic!("Unexpected trailing tokens in macro") } (name, body_string, span) } fn expand_peg(name: String, filename: String, source: String) -> TokenStream { let code = match peg::compile(filename, source) { Ok(code) => code, Err(()) => panic!("Errors above in rust-peg grammar"), }; format!("mod {} {{ {} }}", name, code).parse().unwrap() }
use std::collections::HashMap; use crate::mechanics::damage::DamageMultiplier; use crate::types::MonsterType; use crate::types::MonsterType::*; struct EffectivenessMap { map: HashMap<MonsterType, DamageMultiplier>, } impl EffectivenessMap { fn new() -> EffectivenessMap { EffectivenessMap { map: HashMap::new(), } } #[allow(dead_code)] pub fn get_effectiveness_for_type(&self, other_type: &MonsterType) -> DamageMultiplier { *self.map.get(&other_type).unwrap() } } pub struct EffectivenessMaps { maps: HashMap<MonsterType, EffectivenessMap>, } impl EffectivenessMaps { fn new() -> EffectivenessMaps { EffectivenessMaps { maps: HashMap::new(), } } fn insert( &mut self, monster_type: MonsterType, map: EffectivenessMap, ) -> Option<EffectivenessMap> { self.maps.insert(monster_type, map) } #[allow(dead_code)] pub fn get_effectiveness_for_type( &self, attack_type: &MonsterType, receiver_type: &MonsterType, ) -> DamageMultiplier { self.maps .get(attack_type) .unwrap() .get_effectiveness_for_type(receiver_type) } } impl Default for EffectivenessMaps { fn default() -> Self { let mut maps: EffectivenessMaps = EffectivenessMaps::new(); let fire_map = { let mut map = EffectivenessMap::new(); map.map.insert(FIRE, DamageMultiplier::SINGLE); map.map.insert(PLANT, DamageMultiplier::DOUBLE); map.map.insert(WATER, DamageMultiplier::HALF); map }; maps.insert(FIRE, fire_map); let plant_map: EffectivenessMap = { let mut map = EffectivenessMap::new(); map.map.insert(FIRE, DamageMultiplier::HALF); map.map.insert(PLANT, DamageMultiplier::SINGLE); map.map.insert(WATER, DamageMultiplier::DOUBLE); map }; maps.insert(PLANT, plant_map); let water_map: EffectivenessMap = { let mut map = EffectivenessMap::new(); map.map.insert(FIRE, DamageMultiplier::DOUBLE); map.map.insert(PLANT, DamageMultiplier::HALF); map.map.insert(WATER, DamageMultiplier::SINGLE); map }; maps.insert(WATER, water_map); maps } } #[cfg(test)] mod tests { use crate::mechanics::damage::DamageMultiplier; use crate::types::effectiveness::effectiveness_maps::EffectivenessMaps; use crate::types::MonsterType; #[test] fn test_get_effectiveness_for_type() { let eff: DamageMultiplier = EffectivenessMaps::default() .get_effectiveness_for_type(&MonsterType::FIRE, &MonsterType::WATER); assert_eq!(eff, DamageMultiplier::HALF) } }
use crate::header::Header; use crate::header_flag::HeaderFlag; use crate::message_render::MessageRender; use crate::name::Name; use crate::question::Question; use crate::rr_class::RRClass; use crate::rr_type::RRType; use crate::util::InputBuffer; use anyhow::{bail, Result}; use std::fmt; #[derive(Debug, Clone, Eq, PartialEq)] pub struct Request { pub header: Header, pub question: Question, } impl Request { pub fn new(name: Name, qtype: RRType) -> Self { let mut header: Header = Default::default(); header.set_flag(HeaderFlag::RecursionDesired, true); header.id = rand::random::<u16>(); Request { header, question: Question { name, typ: qtype, class: RRClass::IN, }, } } pub fn from_wire(raw: &[u8]) -> Result<Self> { let buf = &mut InputBuffer::new(raw); let header = Header::from_wire(buf)?; let question = if header.qd_count == 1 { Question::from_wire(buf)? } else { bail!("request has no question"); }; if header.an_count != 0 { bail!("request has answer"); } if header.an_count != 0 { bail!("request has auth"); } Ok(Request { header, question }) } pub fn to_wire(&self, render: &mut MessageRender) -> Result<usize> { self.header.to_wire(render)?; self.question.to_wire(render)?; Ok(render.len()) } } impl fmt::Display for Request { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { writeln!(f, "{}", self.header)?; writeln!(f, ";; QUESTION SECTION:\n{}\n", self.question)?; Ok(()) } }
pub mod boids;
fn main(){ proconio::input!{n:f64}; println!("{}",2.*n*std::f64::consts::PI) }
use lazy_static::lazy_static; use std::path; use std::sync::{atomic, mpsc, Mutex}; use std::thread; use std::time; use crate::commands::{LllCommand, LllRunnable}; use crate::context::LllContext; use crate::error::LllError; use crate::fs::{fs_extra_extra, LllDirList}; use crate::window::LllView; lazy_static! { static ref SELECTED_FILES: Mutex<Option<Vec<path::PathBuf>>> = Mutex::new(None); static ref FILE_OPERATION: Mutex<FileOp> = Mutex::new(FileOp::Copy); static ref TAB_SRC: atomic::AtomicUsize = atomic::AtomicUsize::new(0); } enum FileOp { Cut, Copy, } struct LocalState; impl LocalState { pub fn set_file_op(operation: FileOp) { let mut data = FILE_OPERATION.lock().unwrap(); *data = operation; } pub fn set_tab_src(tab_index: usize) { TAB_SRC.store(tab_index, atomic::Ordering::Release); } pub fn repopulated_selected_files(dirlist: &LllDirList) -> std::io::Result<()> { let selected = dirlist.get_selected_paths(); if selected.is_empty() { Err(std::io::Error::new( std::io::ErrorKind::Other, "no files selected", )) } else { let selected_clone: Vec<path::PathBuf> = selected.iter().map(|p| (*p).clone()).collect(); let mut data = SELECTED_FILES.lock().unwrap(); *data = Some(selected_clone); Ok(()) } } } pub struct FileOperationThread<T, Q> { pub tab_src: usize, pub tab_dest: usize, pub handle: thread::JoinHandle<std::io::Result<T>>, pub recv: mpsc::Receiver<Q>, } impl<T, Q> FileOperationThread<T, Q> { pub fn recv_timeout( &self, wait_duration: &time::Duration, ) -> Result<Q, mpsc::RecvTimeoutError> { self.recv.recv_timeout(*wait_duration) } } #[derive(Clone, Debug)] pub struct CutFiles; impl CutFiles { pub fn new() -> Self { CutFiles } pub const fn command() -> &'static str { "cut_files" } } impl LllCommand for CutFiles {} impl std::fmt::Display for CutFiles { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(Self::command()) } } impl LllRunnable for CutFiles { fn execute(&self, context: &mut LllContext, _: &LllView) -> Result<(), LllError> { let curr_tab = context.curr_tab_ref(); match LocalState::repopulated_selected_files(&curr_tab.curr_list) { Ok(_) => { LocalState::set_file_op(FileOp::Cut); LocalState::set_tab_src(context.curr_tab_index); Ok(()) } Err(e) => Err(LllError::IO(e)), } } } #[derive(Clone, Debug)] pub struct CopyFiles; impl CopyFiles { pub fn new() -> Self { CopyFiles } pub const fn command() -> &'static str { "copy_files" } } impl LllCommand for CopyFiles {} impl std::fmt::Display for CopyFiles { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(Self::command()) } } impl LllRunnable for CopyFiles { fn execute(&self, context: &mut LllContext, _: &LllView) -> Result<(), LllError> { let curr_tab = context.curr_tab_ref(); match LocalState::repopulated_selected_files(&curr_tab.curr_list) { Ok(_) => { LocalState::set_file_op(FileOp::Copy); LocalState::set_tab_src(context.curr_tab_index); Ok(()) } Err(e) => Err(LllError::IO(e)), } } } pub struct PasteFiles { options: fs_extra::dir::CopyOptions, } impl LllCommand for PasteFiles {} impl std::fmt::Display for PasteFiles { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!( f, "{} overwrite={} skip_exist={}", Self::command(), self.options.overwrite, self.options.skip_exist, ) } } impl std::fmt::Debug for PasteFiles { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(Self::command()) } } impl LllRunnable for PasteFiles { fn execute(&self, context: &mut LllContext, _: &LllView) -> Result<(), LllError> { let file_operation = FILE_OPERATION.lock().unwrap(); let thread = match *file_operation { FileOp::Copy => self.copy_paste(context), FileOp::Cut => self.cut_paste(context), }; match thread { Ok(s) => { context.threads.push(s); Ok(()) } Err(e) => Err(LllError::IO(e)), } } } impl PasteFiles { pub fn new(options: fs_extra::dir::CopyOptions) -> Self { PasteFiles { options } } pub const fn command() -> &'static str { "paste_files" } fn cut_paste( &self, context: &mut LllContext, ) -> std::io::Result<FileOperationThread<u64, fs_extra::TransitProcess>> { let tab_src = TAB_SRC.load(atomic::Ordering::SeqCst); let tab_dest = context.curr_tab_index; let destination = context.tabs[tab_dest].curr_path.clone(); let options = self.options.clone(); let (tx, rx) = mpsc::channel(); let paths = SELECTED_FILES.lock().unwrap().take(); match paths { Some(paths) => { if paths.is_empty() { return Err(std::io::Error::new( std::io::ErrorKind::Other, "no files selected", )); } let handle = thread::spawn(move || { let progress_handle = |process_info: fs_extra::TransitProcess| { tx.send(process_info); fs_extra::dir::TransitProcessResult::ContinueOrAbort }; fs_extra_extra::fs_cut_with_progress( &paths, &destination, options.clone(), progress_handle, ) }); let thread = FileOperationThread { tab_src, tab_dest, handle, recv: rx, }; Ok(thread) } None => Err(std::io::Error::new( std::io::ErrorKind::Other, "no files selected", )), } } fn copy_paste( &self, context: &mut LllContext, ) -> std::io::Result<FileOperationThread<u64, fs_extra::TransitProcess>> { let tab_dest = context.curr_tab_index; let destination = context.tabs[tab_dest].curr_path.clone(); let tab_src = TAB_SRC.load(atomic::Ordering::SeqCst); let options = self.options.clone(); let (tx, rx) = mpsc::channel(); let paths = SELECTED_FILES.lock().unwrap().take(); match paths { Some(paths) => { if paths.is_empty() { return Err(std::io::Error::new( std::io::ErrorKind::Other, "no files selected", )); } let handle = thread::spawn(move || { let progress_handle = |process_info: fs_extra::TransitProcess| { tx.send(process_info); fs_extra::dir::TransitProcessResult::ContinueOrAbort }; fs_extra_extra::fs_copy_with_progress( &paths, &destination, options.clone(), progress_handle, ) }); let thread = FileOperationThread { tab_src, tab_dest, handle, recv: rx, }; Ok(thread) } None => Err(std::io::Error::new( std::io::ErrorKind::Other, "no files selected", )), } } }
use axum::{ handler::{get, post}, AddExtensionLayer, Router, }; use fork_backend::auth::{self, session::UserSession}; use fork_backend::init::init_appliations; use std::net::SocketAddr; use tracing::info; #[tokio::main] async fn main() { let app_connections = init_appliations(); info!("build app router"); // build our application with a route let app = Router::new() // `GET /` goes to `root` .route("/", get(root)) // auth related control // `GET /` login with cookie and session .route("/login", post(auth::controller::login)) .route("/logout", post(auth::controller::logout)) .layer(AddExtensionLayer::new(app_connections)); // run our app with hyper // `axum::Server` is a re-export of `hyper::Server` let addr = SocketAddr::from(([127, 0, 0, 1], 3030)); info!("listening on {}", addr); axum::Server::bind(&addr) .serve(app.into_make_service()) .await .unwrap(); } // basic handler that responds with a static string async fn root() -> &'static str { "Hello, World!" }
//! Configuration use serde::Deserialize; use failure::Fail; use std::{ fs::read_to_string, io, path::Path, }; use toml; #[derive(Clone, Deserialize)] // Global configuration structure pub struct Cfg { /// Web server configuration pub server: ServerCfg, // /// Log mechanism configuration // pub log: LogCfg, /// Persistance storage configuration pub database: StorageCfg, } #[derive(Clone, Deserialize)] #[serde(rename_all = "kebab-case")] /// Server configuration key/values. pub struct ServerCfg { /// The full server URL pub url: String, } #[derive(Clone, Deserialize)] #[serde(rename_all = "kebab-case")] /// Persistance storage configuration key/values. pub struct StorageCfg { /// The full server URL pub url: String, } #[derive(Debug, Fail)] pub enum CfgError { #[fail(display = "Unable to read configuration file: {}", _0)] ReadCfgFile(#[fail(cause)] io::Error), #[fail(display = "Invalid format for config file: {}", _0)] InvalidCfgFile(#[fail(cause)]toml::de::Error), } impl Cfg { /// Creates a new `Cfg` instance using the parameters found in the given /// TOML configuration file. If the file cannot be found or the file is /// invalid, an `Error` is returned. pub fn load_config_file(filename: &Path) -> Result<Cfg, CfgError> { let path = &filename; let cfg_file_str = read_to_string(path) .map_err(CfgError::ReadCfgFile)?; let cfg = toml::de::from_str(&cfg_file_str) .map_err(CfgError::InvalidCfgFile)?; Ok(cfg) } } // impl FromStr for Cfg { // type Err = failure::Error; // /// Load a `Cfg` from some string. // fn from(src: &str) -> Result<Self, Self::Err> { // toml::from_str(src) // .map_err(|e| format_err!("Failed to load config from: {}", e)) // } // } #[cfg(test)] mod test { use super::Cfg; use std::path::Path; #[test] fn parse_cfg_with_fields() { let toml = Path::new("./config_test.toml"); let cfg_result = Cfg::load_config_file(toml); match cfg_result { Ok(cfg) => { assert_ne!(cfg.server.url.is_empty(), true); } Err(e) => panic!("Failed configuration parse: {:?}", e) } } }
use super::basic; use super::tile::Terrain; use grid::{self, Grid, Pos}; use rand::Rng; pub(super) fn add_exit<R: Rng>(level: &mut Grid<Terrain>, rng: &mut R) -> Grid<Terrain> { let mut positions: Vec<Pos> = grid::inner_positions().collect(); rng.shuffle(&mut positions); loop { let next_level = basic::generate(rng); if let Some(exit_pos) = find_exit(level, &next_level, &positions) { level[exit_pos] = Terrain::Exit; break Grid::new(|pos| { if pos == exit_pos { Terrain::Entrance } else { Terrain::from(next_level[pos]) } }); } } } fn find_exit( level: &Grid<Terrain>, next_level: &Grid<basic::Terrain>, positions: &[Pos], ) -> Option<Pos> { for &pos in positions { if is_valid_exit(pos, level) && is_valid_entrance(pos, next_level) { return Some(pos); } } None } fn is_valid_exit(pos: Pos, level: &Grid<Terrain>) -> bool { level[pos] == Terrain::Wall && basic::count_neighbor_groups(pos, level, |t| t != Terrain::Wall) == 1 && count_neighbors(pos, level, |t| t == Terrain::Wall) == 4 && count_neighbors(pos, level, |t| t == Terrain::Entrance) == 0 } fn is_valid_entrance(pos: Pos, level: &Grid<basic::Terrain>) -> bool { level[pos] == basic::Terrain::Wall && basic::count_floor_groups(pos, level) == 1 && count_neighbors(pos, level, |t| t == basic::Terrain::Wall) == 4 } fn count_neighbors<T: Copy, F>(pos: Pos, level: &Grid<T>, predicate: F) -> usize where F: Fn(T) -> bool, { pos.neighbors().filter(|&pos| predicate(level[pos])).count() }
#![cfg(target_arch = "x86_64")] use std::arch::x86_64::*; use crate::detail::sse::{hi_dp_bc, rcp_nr1, rsqrt_nr1}; //hi_dp, hi_dp_ss // Partition memory layouts // LSB --> MSB // p0: (e0, e1, e2, e3) // p1: (1, e23, e31, e12) // p2: (e0123, e01, e02, e03) // p3: (e123, e032, e013, e021) // a := p1 // b := p2 // a + b is a general bivector but it is most likely *non-simple* meaning // that it is neither purely real nor purely ideal. // Exponentiates the bivector and returns the motor defined by partitions 1 // and 2. #[inline] pub fn simd_exp(a: __m128, b: __m128, p1_out: &mut __m128, p2_out: &mut __m128) { // The exponential map produces a continuous group of rotations about an // axis. We'd *like* to evaluate the exp(a + b) as exp(a)exp(b) but we // cannot do that in general because a and b do not commute (consider // the differences between the Taylor expansion of exp(ab) and // exp(a)exp(b)). // First, we need to decompose the bivector into the sum of two // commutative bivectors (the product of these two parts will be a // scalar multiple of the pseudoscalar; see "Bivector times its ideal // axis and vice versa in demo.klein"). To do this, we compute the // squared norm of the bivector: // // NOTE: a sign flip is introduced since the square of a Euclidean // line is negative // // (a1^2 + a2^2 + a3^2) - 2(a1 b1 + a2 b2 + a3 b3) e0123 unsafe { // Check if the bivector we're exponentiating is ideal let mask = _mm_movemask_ps(_mm_cmpeq_ps(a, _mm_setzero_ps())); if mask == 0xf { // When exponentiating an ideal line, the terms past the linear // term in the Taylor series expansion vanishes *p1_out = _mm_set_ss(1.); *p2_out = b; return; } // Broadcast dot(a, a) ignoring the scalar component to all components // of a2 let a2 = hi_dp_bc(a, a); let ab = hi_dp_bc(a, b); // Next, we need the sqrt of that quantity. Since e0123 squares to 0, // this has a closed form solution. // // sqrt(a1^2 + a2^2 + a3^2) // - (a1 b1 + a2 b2 + a3 b3) / sqrt(a1^2 + a2^2 + a3^2) e0123 // // (relabeling) = u + vI // // (square the above quantity yourself to quickly verify the claim) // Maximum relative error < 1.5*2e-12 let a2_sqrt_rcp = rsqrt_nr1(a2); let u = _mm_mul_ps(a2, a2_sqrt_rcp); // Don't forget the minus later! let minus_v = _mm_mul_ps(ab, a2_sqrt_rcp); // Last, we need the reciprocal of the norm to compute the normalized // bivector. // // 1 / sqrt(a1^2 + a2^2 + a3^2) // + (a1 b1 + a2 b2 + a3 b3) / (a1^2 + a2^2 + a3^2)^(3/2) e0123 // // The original bivector * the inverse norm gives us a normalized // bivector. let norm_real = _mm_mul_ps(a, a2_sqrt_rcp); let mut norm_ideal = _mm_mul_ps(b, a2_sqrt_rcp); // The real part of the bivector also interacts with the pseudoscalar to // produce a portion of the normalized ideal part // e12 e0123 = -e03, e31 e0123 = -e02, e23 e0123 = -e01 // Notice how the products above actually commute norm_ideal = _mm_sub_ps( norm_ideal, _mm_mul_ps(a, _mm_mul_ps(ab, _mm_mul_ps(a2_sqrt_rcp, rcp_nr1(a2)))), ); // The norm * our normalized bivector is the original bivector (a + b). // Thus, we have: // // (u + vI)n = u n + v n e0123 // // Note that n and n e0123 are perpendicular (n e0123 lies on the ideal // plane, and all ideal components of n are extinguished after // polarization). As a result, we can now decompose the exponential. // // e^(u n + v n e0123) = e^(u n) e^(v n e0123) = // (cosu + sinu n) * (1 + v n e0123) = // cosu + sinu n + v n cosu e0123 + v sinu n^2 e0123 = // cosu + sinu n + v n cosu e0123 - v sinu e0123 // // where we've used the fact that n is normalized and squares to -1. let mut uv = <[f32; 2]>::default(); _mm_store_ss(&mut uv[0], u); // Note the v here corresponds to minus_v _mm_store_ss(&mut uv[1], minus_v); let mut sincosu = <[f32; 2]>::default(); sincosu[0] = f32::sin(uv[0]); sincosu[1] = f32::cos(uv[0]); let sinu = _mm_set1_ps(sincosu[0]); *p1_out = _mm_add_ps( _mm_set_ps(0., 0., 0., sincosu[1]), _mm_mul_ps(sinu, norm_real), ); // The second partition has contributions from both the real and ideal // parts. let cosu = _mm_set_ps(sincosu[1], sincosu[1], sincosu[1], 0.); let minus_vcosu = _mm_mul_ps(minus_v, cosu); *p2_out = _mm_mul_ps(sinu, norm_ideal); *p2_out = _mm_add_ps(*p2_out, _mm_mul_ps(minus_vcosu, norm_real)); let minus_vsinu = uv[1] * sincosu[0]; *p2_out = _mm_add_ps(_mm_set_ps(0., 0., 0., minus_vsinu), *p2_out); } } #[allow(clippy::many_single_char_names)] #[inline] pub fn simd_log(p1: __m128, p2: __m128, p1_out: &mut __m128, p2_out: &mut __m128) { // The logarithm follows from the derivation of the exponential. Working // backwards, we ended up computing the exponential like so: // // cosu + sinu n + v n cosu e0123 - v sinu e0123 = // (cosu - v sinu e0123) + (sinu + v cosu e0123) n // // where n is the normalized bivector. If we compute the norm, that will // allow us to match it to sinu + vcosu e0123, which will then allow us // to deduce u and v. // The first thing we need to do is extract only the bivector components // from the motor. unsafe { let bv_mask = _mm_set_ps(1., 1., 1., 0.); let a = _mm_mul_ps(bv_mask, p1); // let b = _mm_mul_ps(bv_mask, p2); // Early out if we're taking the log of a motor without any rotation let mask = _mm_movemask_ps(_mm_cmpeq_ps(a, _mm_setzero_ps())); println!("set rotation"); if mask == 0xf { println!("no rotation"); *p1_out = _mm_setzero_ps(); *p2_out = p2; return; } let b = _mm_mul_ps(bv_mask, p2); // Next, we need to compute the norm as in the exponential. let a2 = hi_dp_bc(a, a); let ab = hi_dp_bc(a, b); let a2_sqrt_rcp = rsqrt_nr1(a2); let s = _mm_mul_ps(a2, a2_sqrt_rcp); let minus_t = _mm_mul_ps(ab, a2_sqrt_rcp); // s + t e0123 is the norm of our bivector. // Store the scalar component let mut p: f32 = 0.; _mm_store_ss(&mut p, p1); // Store the pseudoscalar component let mut q: f32 = 0.; _mm_store_ss(&mut q, p2); let mut s_scalar: f32 = 0.; _mm_store_ss(&mut s_scalar, s); let mut t_scalar: f32 = 0.; _mm_store_ss(&mut t_scalar, minus_t); t_scalar *= -1.; // p = cosu // q = -v sinu // s_scalar = sinu // t_scalar = v cosu let u: f32; let v: f32; let p_zero: bool = f32::abs(p) < 1e-6; if p_zero { u = f32::atan2(-q, t_scalar); v = -q / s_scalar; } else { u = f32::atan2(s_scalar, p); v = t_scalar / p; } // float u = p_zero ? std::atan2(-q, t_scalar) : std::atan2(s_scalar, p); // float v = p_zero ? -q / s_scalar : t_scalar / p; // Now, (u + v e0123) * n when exponentiated will give us the motor, so // (u + v e0123) * n is the logarithm. To proceed, we need to compute // the normalized bivector. let norm_real = _mm_mul_ps(a, a2_sqrt_rcp); let mut norm_ideal = _mm_mul_ps(b, a2_sqrt_rcp); norm_ideal = _mm_sub_ps( norm_ideal, _mm_mul_ps(a, _mm_mul_ps(ab, _mm_mul_ps(a2_sqrt_rcp, rcp_nr1(a2)))), ); let uvec = _mm_set1_ps(u); *p1_out = _mm_mul_ps(uvec, norm_real); *p2_out = _mm_mul_ps(uvec, norm_ideal); *p2_out = _mm_sub_ps(*p2_out, _mm_mul_ps(_mm_set1_ps(v), norm_real)); } }
// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { failure::Error, fidl_fuchsia_test_echos::{EchoExposedByParentMarker, EchoHiddenByParentMarker}, fuchsia_async as fasync, fuchsia_component::client::connect_to_service, std::env, std::io::Read, }; #[fasync::run_singlethreaded] async fn main() -> Result<(), Error> { env::set_var("RUST_BACKTRACE", "full"); // Check that only the service provided by the inner component is available, // and that we're connected to its implementation of the service which always // returns `42` rather than echoing. let echo = connect_to_service::<EchoExposedByParentMarker>()?; assert_eq!(42, echo.echo(1).await?); let echo = connect_to_service::<EchoHiddenByParentMarker>()?; match echo.echo(2).await { Err(e) if e.is_closed() => {} Ok(_) => panic!("inner nested component successfully echoed through parent"), Err(e) => panic!("Unexpected error connecting to hidden service: {:?}", e), } // Check that `dir_exposed_to_inner` is available. let mut buffer = String::new(); std::fs::File::open("/dir_exposed_to_inner/it_works") .expect("open the exposed file") .read_to_string(&mut buffer) .expect("read from the exposed file"); assert_eq!(buffer, "indeed"); Ok(()) }
use super::lob_writer_util::{get_utf8_tail_len, LobWriteMode}; use crate::{ conn::AmConnCore, internal_returnvalue::InternalReturnValue, protocol::parts::{ParameterDescriptors, ResultSetMetadata, TypeId, WriteLobRequest}, protocol::{util, Part, PartKind, Reply, ReplyType, Request, RequestType}, {HdbError, HdbResult, ServerUsage}, }; use std::{io::Write, sync::Arc}; #[derive(Debug)] pub struct LobWriter<'a> { locator_id: u64, type_id: TypeId, am_conn_core: AmConnCore, o_a_rsmd: Option<&'a Arc<ResultSetMetadata>>, o_a_descriptors: Option<&'a Arc<ParameterDescriptors>>, server_usage: ServerUsage, buffer: Vec<u8>, lob_write_length: usize, proc_result: Option<Vec<InternalReturnValue>>, } impl<'a> LobWriter<'a> { pub fn new( locator_id: u64, type_id: TypeId, am_conn_core: AmConnCore, o_a_rsmd: Option<&'a Arc<ResultSetMetadata>>, o_a_descriptors: Option<&'a Arc<ParameterDescriptors>>, ) -> HdbResult<LobWriter<'a>> { if let TypeId::BLOB | TypeId::CLOB | TypeId::NCLOB = type_id { let lob_write_length = am_conn_core.sync_lock()?.get_lob_write_length(); Ok(LobWriter { locator_id, type_id, am_conn_core, o_a_rsmd, o_a_descriptors, server_usage: ServerUsage::default(), buffer: Vec::<u8>::with_capacity(lob_write_length + 8200), lob_write_length, proc_result: None, }) } else { Err(HdbError::ImplDetailed(format!( "Unsupported type-id {type_id:?}" ))) } } pub fn into_internal_return_values(self) -> Option<Vec<InternalReturnValue>> { self.proc_result } // Note that requested_length and offset count either bytes (for BLOB, CLOB), // or 1-2-3-chars (for NCLOB) fn sync_write_a_lob_chunk( &mut self, buf: &[u8], locator_id: u64, lob_write_mode: &LobWriteMode, ) -> HdbResult<Vec<u64>> { let mut request = Request::new(RequestType::WriteLob, 0); let write_lob_request = WriteLobRequest::new( locator_id, -1_i64, buf, match lob_write_mode { LobWriteMode::Append => false, LobWriteMode::Last => true, }, ); // LobWriteMode::Offset(offset) => // WriteLobRequest::new(locator_id, offset /* or offset + 1? */, buf, true), request.push(Part::WriteLobRequest(write_lob_request)); let reply = self.am_conn_core.sync_full_send( request, self.o_a_rsmd, self.o_a_descriptors, &mut None, )?; match reply.replytype { // regular response ReplyType::WriteLob => self.evaluate_write_lob_reply(reply), // last response of last IN parameter ReplyType::DbProcedureCall => self.sync_evaluate_dbprocedure_call_reply(reply), _ => Err(HdbError::ImplDetailed(format!( "LobWriter::write_a_lob_chunk got a reply of type {:?}", reply.replytype, ))), } } fn evaluate_write_lob_reply(&mut self, reply: Reply) -> HdbResult<Vec<u64>> { let mut result = None; for part in reply.parts { match part { Part::StatementContext(stmt_ctx) => { self.server_usage.update( stmt_ctx.server_processing_time(), stmt_ctx.server_cpu_time(), stmt_ctx.server_memory_usage(), ); } Part::TransactionFlags(ta_flags) => { if ta_flags.is_committed() { trace!("is committed"); } else { trace!("is not committed"); } } Part::ExecutionResult(_) => { //todo can we do better than just ignore this? } Part::WriteLobReply(write_lob_reply) => { result = Some(write_lob_reply.into_locator_ids()); } _ => warn!( "evaluate_write_lob_reply: unexpected part {:?}", part.kind() ), } } result.ok_or_else(|| HdbError::Impl("No WriteLobReply part found")) } fn sync_evaluate_dbprocedure_call_reply(&mut self, mut reply: Reply) -> HdbResult<Vec<u64>> { let locator_ids = self.evaluate_dbprocedure_call_reply1(&mut reply)?; let internal_return_values = reply.parts.sync_into_internal_return_values( &mut self.am_conn_core, Some(&mut self.server_usage), )?; self.proc_result = Some(internal_return_values); Ok(locator_ids) } fn evaluate_dbprocedure_call_reply1(&mut self, reply: &mut Reply) -> HdbResult<Vec<u64>> { let (server_proc_time, server_cpu_time, server_memory_usage) = match reply.parts.pop_if_kind(PartKind::StatementContext) { Some(Part::StatementContext(stmt_ctx)) => ( stmt_ctx.server_processing_time(), stmt_ctx.server_cpu_time(), stmt_ctx.server_memory_usage(), ), None => (None, None, None), Some(_) => { return Err(HdbError::Impl("Inconsistent StatementContext found")); } }; self.server_usage .update(server_proc_time, server_cpu_time, server_memory_usage); if let Some(Part::TransactionFlags(ta_flags)) = reply.parts.pop_if_kind(PartKind::TransactionFlags) { if ta_flags.is_committed() { trace!("is committed"); } else { trace!("is not committed"); } } let locator_ids = match reply.parts.pop_if_kind(PartKind::WriteLobReply) { Some(Part::WriteLobReply(write_lob_reply)) => write_lob_reply.into_locator_ids(), _ => Vec::default(), }; reply.parts.remove_first_of_kind(PartKind::WriteLobReply); Ok(locator_ids) } } impl<'a> Write for LobWriter<'a> { // Either buffers (in self.buffer) or writes buffer + input to the db fn write(&mut self, input: &[u8]) -> std::io::Result<usize> { trace!("write() with input of len {}", input.len()); if input.len() + self.buffer.len() < self.lob_write_length { self.buffer.extend_from_slice(input); } else { // concatenate buffer and input into payload_raw let payload_raw = if self.buffer.is_empty() { input.to_vec() } else { let mut payload_raw = Vec::<u8>::new(); std::mem::swap(&mut payload_raw, &mut self.buffer); payload_raw.extend_from_slice(input); payload_raw }; debug_assert!(self.buffer.is_empty()); // if necessary, cut off new tail and convert to cesu8 let payload = if let TypeId::CLOB | TypeId::NCLOB = self.type_id { let (cesu8, utf8_tail) = utf8_to_cesu8_and_utf8_tail(payload_raw)?; self.buffer = utf8_tail; cesu8 } else { payload_raw }; self.sync_write_a_lob_chunk(&payload, self.locator_id, &LobWriteMode::Append) .map(|_locator_ids| ()) .map_err(|e| util::io_error(e.to_string()))?; } Ok(input.len()) } fn flush(&mut self) -> std::io::Result<()> { trace!("flush(), with buffer of {} bytes", self.buffer.len()); let mut payload_raw = Vec::<u8>::new(); std::mem::swap(&mut payload_raw, &mut self.buffer); let payload = if let TypeId::CLOB | TypeId::NCLOB = self.type_id { let (cesu8, utf8_tail) = utf8_to_cesu8_and_utf8_tail(payload_raw) .map_err(|e| util::io_error(e.to_string()))?; if !utf8_tail.is_empty() { return Err(util::io_error("stream ending with invalid utf-8")); } cesu8 } else { payload_raw }; self.sync_write_a_lob_chunk(&payload, self.locator_id, &LobWriteMode::Last) .map(|_locator_ids| ()) .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; Ok(()) } } fn utf8_to_cesu8_and_utf8_tail(mut utf8: Vec<u8>) -> std::io::Result<(Vec<u8>, Vec<u8>)> { let tail_len = get_utf8_tail_len(&utf8).map_err(util::io_error)?; let tail = utf8.split_off(utf8.len() - tail_len); Ok(( cesu8::to_cesu8(&String::from_utf8(utf8).map_err(util::io_error)?).to_vec(), tail, )) }
/** * Copyright © 2019 * Sami Shalayel <sami.shalayel@tutamail.com>, * Carl Schwan <carl@carlschwan.eu>, * Daniel Freiermuth <d_freiermu14@cs.uni-kl.de> * * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, * as published by Sam Hocevar. See the LICENSE file for more details. * * This program is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See the LICENSE * file for more details. **/ extern crate image; extern crate nalgebra as na; extern crate wavefront_obj; pub mod camera; pub mod error; pub mod helpers; pub mod intersection; pub mod obj; pub mod ray; pub mod shader; pub mod storage; pub mod world;
use ggez::{ conf, event, graphics::{self, Font, Rect, Text}, nalgebra::Point2, Context, ContextBuilder, GameResult, }; use ggwp_zgui as ui; #[derive(Clone, Copy, Debug)] enum Message { Command1, Command2, } fn make_gui(context: &mut Context, font: Font) -> ui::Result<ui::Gui<Message>> { let mut gui = ui::Gui::new(context); let text_1 = Box::new(Text::new(("[Button1]", font, 32.0))); let text_2 = Box::new(Text::new(("[Button1]", font, 64.0))); let button_1 = ui::Button::new(context, text_1, 0.2, gui.sender(), Message::Command1)?; let button_2 = ui::Button::new(context, text_2, 0.2, gui.sender(), Message::Command2)?; let mut layout = ui::VLayout::new(); layout.add(Box::new(button_1)); layout.add(Box::new(button_2)); let anchor = ui::Anchor(ui::HAnchor::Right, ui::VAnchor::Bottom); gui.add(&ui::pack(layout), anchor); Ok(gui) } struct State { gui: ui::Gui<Message>, } impl State { fn new(context: &mut Context) -> ui::Result<State> { let (w, h) = graphics::drawable_size(context); let font = Font::new(context, "/Karla-Regular.ttf")?; let gui = make_gui(context, font)?; let mut this = State { gui }; this.resize(context, w as _, h as _)?; Ok(this) } fn resize(&mut self, context: &mut Context, w: f32, h: f32) -> GameResult { let aspect_ratio = w / h; let coordinates = Rect::new(-aspect_ratio, -1.0, aspect_ratio * 2.0, 2.0); graphics::set_screen_coordinates(context, coordinates)?; self.gui.resize(aspect_ratio); Ok(()) } fn draw_scene(&self, context: &mut Context) -> GameResult { let circle = { let mode = graphics::DrawMode::fill(); let pos = [0.0, 0.0]; let radius = 0.4; let tolerance = 0.001; let color = [0.5, 0.5, 0.5, 1.0].into(); graphics::Mesh::new_circle(context, mode, pos, radius, tolerance, color)? }; let param = graphics::DrawParam::new(); graphics::draw(context, &circle, param)?; Ok(()) } } impl event::EventHandler for State { fn update(&mut self, _: &mut Context) -> GameResult { Ok(()) } fn draw(&mut self, context: &mut Context) -> GameResult { let bg_color = [1.0, 1.0, 1.0, 1.0].into(); graphics::clear(context, bg_color); self.draw_scene(context)?; self.gui.draw(context)?; graphics::present(context) } fn resize_event(&mut self, context: &mut Context, w: f32, h: f32) { self.resize(context, w, h).expect("Can't resize the window"); } fn mouse_button_up_event( &mut self, context: &mut Context, _: event::MouseButton, x: f32, y: f32, ) { let window_pos = Point2::new(x, y); let pos = ui::window_to_screen(context, window_pos); let message = self.gui.click(pos); println!("[{},{}] -> {}: {:?}", x, y, pos, message); } } fn context() -> GameResult<(Context, event::EventsLoop)> { let name = file!(); let window_conf = conf::WindowSetup::default().title(name); let window_mode = conf::WindowMode::default().resizable(true); ContextBuilder::new(name, "ozkriff") .window_setup(window_conf) .window_mode(window_mode) .add_resource_path("resources") .build() } fn main() -> ui::Result { let (mut context, mut events_loop) = context()?; let mut state = State::new(&mut context)?; event::run(&mut context, &mut events_loop, &mut state)?; Ok(()) }
// Copyright 2021 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::net::Ipv4Addr; use common_exception::Result; use common_grpc::DNSResolver; use common_meta_types::Endpoint; use common_meta_types::MetaStartupError; use common_meta_types::NodeId; use once_cell::sync::Lazy; pub static DATABEND_COMMIT_VERSION: Lazy<String> = Lazy::new(|| { let build_semver = option_env!("VERGEN_BUILD_SEMVER"); let git_sha = option_env!("VERGEN_GIT_SHA"); let rustc_semver = option_env!("VERGEN_RUSTC_SEMVER"); let timestamp = option_env!("VERGEN_BUILD_TIMESTAMP"); match (build_semver, git_sha, rustc_semver, timestamp) { #[cfg(not(feature = "simd"))] (Some(v1), Some(v2), Some(v3), Some(v4)) => format!("{}-{}({}-{})", v1, v2, v3, v4), #[cfg(feature = "simd")] (Some(v1), Some(v2), Some(v3), Some(v4)) => { format!("{}-{}-simd({}-{})", v1, v2, v3, v4) } _ => String::new(), } }); #[derive(Clone, Debug, PartialEq, Eq, serde::Serialize)] pub struct RaftConfig { /// Identify a config. /// This is only meant to make debugging easier with more than one Config involved. pub config_id: String, /// The local listening host for metadata communication. /// This config does not need to be stored in raft-store, /// only used when metasrv startup and listen to. pub raft_listen_host: String, /// The hostname that other nodes will use to connect this node. /// This host should be stored in raft store and be replicated to the raft cluster, /// i.e., when calling add_node(). /// Use `localhost` by default. pub raft_advertise_host: String, /// The listening port for metadata communication. pub raft_api_port: u32, /// The dir to store persisted meta state, including raft logs, state machine etc. pub raft_dir: String, /// Whether to fsync meta to disk for every meta write(raft log, state machine etc). /// No-sync brings risks of data loss during a crash. /// You should only use this in a testing environment, unless YOU KNOW WHAT YOU ARE DOING. pub no_sync: bool, /// The number of logs since the last snapshot to trigger next snapshot. pub snapshot_logs_since_last: u64, /// The interval in milli seconds at which a leader send heartbeat message to followers. /// Different value of this setting on leader and followers may cause unexpected behavior. pub heartbeat_interval: u64, /// The max time in milli seconds that a leader wait for install-snapshot ack from a follower or non-voter. pub install_snapshot_timeout: u64, /// The maximum number of applied logs to keep before purging pub max_applied_log_to_keep: u64, /// Single node metasrv. It creates a single node cluster if meta data is not initialized. /// Otherwise it opens the previous one. /// This is mainly for testing purpose. pub single: bool, /// Bring up a metasrv node and join a cluster. /// /// The value is one or more addresses of a node in the cluster, to which this node sends a `join` request. pub join: Vec<String>, /// Do not run databend-meta, but just remove a node from its cluster. /// /// The value is one or more addresses of a node in the cluster, to which this node sends a `leave` request. pub leave_via: Vec<String>, /// The node id to leave from the cluster. /// /// It will be ignored if `--leave-via` is absent. pub leave_id: Option<NodeId>, /// The node id. Only used when this server is not initialized, /// e.g. --boot or --single for the first time. /// Otherwise this argument is ignored. pub id: NodeId, /// For test only: specifies the tree name prefix pub sled_tree_prefix: String, /// The node name. If the user specifies a name, /// the user-supplied name is used, if not, the default name is used. pub cluster_name: String, } pub fn get_default_raft_advertise_host() -> String { match hostname::get() { Ok(h) => match h.into_string() { Ok(h) => h, _ => "UnknownHost".to_string(), }, _ => "UnknownHost".to_string(), } } impl Default for RaftConfig { fn default() -> Self { Self { config_id: "".to_string(), raft_listen_host: "127.0.0.1".to_string(), raft_advertise_host: get_default_raft_advertise_host(), raft_api_port: 28004, raft_dir: "./.databend/meta".to_string(), no_sync: false, snapshot_logs_since_last: 1024, heartbeat_interval: 1000, install_snapshot_timeout: 4000, max_applied_log_to_keep: 1000, single: false, join: vec![], leave_via: vec![], leave_id: None, id: 0, sled_tree_prefix: "".to_string(), cluster_name: "foo_cluster".to_string(), } } } impl RaftConfig { pub fn raft_api_listen_host_string(&self) -> String { format!("{}:{}", self.raft_listen_host, self.raft_api_port) } pub fn raft_api_advertise_host_string(&self) -> String { format!("{}:{}", self.raft_advertise_host, self.raft_api_port) } pub fn raft_api_listen_host_endpoint(&self) -> Endpoint { Endpoint { addr: self.raft_listen_host.clone(), port: self.raft_api_port, } } pub fn raft_api_advertise_host_endpoint(&self) -> Endpoint { Endpoint { addr: self.raft_advertise_host.clone(), port: self.raft_api_port, } } /// Support ip address and hostname pub async fn raft_api_addr(&self) -> Result<Endpoint> { let ipv4_addr = self.raft_advertise_host.as_str().parse::<Ipv4Addr>(); match ipv4_addr { Ok(addr) => Ok(Endpoint { addr: addr.to_string(), port: self.raft_api_port, }), Err(_) => { let _ip_addrs = DNSResolver::instance()? .resolve(self.raft_advertise_host.clone()) .await?; Ok(Endpoint { addr: _ip_addrs[0].to_string(), port: self.raft_api_port, }) } } } /// Returns true to fsync after a write operation to meta. pub fn is_sync(&self) -> bool { !self.no_sync } /// Returns the min and max election timeout, in milli seconds. /// /// Raft will choose a random timeout in this range for next election. pub fn election_timeout(&self) -> (u64, u64) { (self.heartbeat_interval * 5, self.heartbeat_interval * 7) } pub fn check(&self) -> std::result::Result<(), MetaStartupError> { // If just leaving, does not need to check other config if !self.leave_via.is_empty() { return Ok(()); } // There two cases: // - both join and single is set // - neither join nor single is set if self.join.is_empty() != self.single { return Err(MetaStartupError::InvalidConfig(String::from( "at least one of `single` and `join` needs to be enabled", ))); } let self_addr = self.raft_api_listen_host_string(); if self.join.contains(&self_addr) { return Err(MetaStartupError::InvalidConfig(String::from( "--join must not be set to itself", ))); } Ok(()) } /// Create a unique sled::Tree name by prepending a unique prefix. /// So that multiple instance that depends on a sled::Tree can be used in one process. /// sled does not allow to open multiple `sled::Db` in one process. pub fn tree_name(&self, name: impl std::fmt::Display) -> String { format!("{}{}", self.sled_tree_prefix, name) } }
#![allow(dead_code)] use crate::{ components::*, ecs::{systems::ParallelRunnable, *}, math::Matrix4, }; pub fn build() -> impl ParallelRunnable { SystemBuilder::<()>::new("LocalToWorldUpdateSystem") // Translation .with_query(<(Write<LocalToWorld>, Read<Translation>)>::query().filter( !component::<Parent>() & !component::<Rotation>() & !component::<Scale>() & !component::<NonUniformScale>() & (maybe_changed::<Translation>()), )) // Rotation .with_query(<(Write<LocalToWorld>, Read<Rotation>)>::query().filter( !component::<Parent>() & !component::<Translation>() & !component::<Scale>() & !component::<NonUniformScale>() & (maybe_changed::<Rotation>()), )) // Scale .with_query(<(Write<LocalToWorld>, Read<Scale>)>::query().filter( !component::<Parent>() & !component::<Translation>() & !component::<Rotation>() & !component::<NonUniformScale>() & (maybe_changed::<Scale>()), )) // NonUniformScale .with_query( <(Write<LocalToWorld>, Read<NonUniformScale>)>::query().filter( !component::<Parent>() & !component::<Translation>() & !component::<Rotation>() & !component::<Scale>() & (maybe_changed::<NonUniformScale>()), ), ) // Translation + Rotation .with_query( <(Write<LocalToWorld>, Read<Translation>, Read<Rotation>)>::query().filter( !component::<Parent>() & !component::<Scale>() & !component::<NonUniformScale>() & (maybe_changed::<Translation>() | maybe_changed::<Rotation>()), ), ) // Translation + Scale .with_query( <(Write<LocalToWorld>, Read<Translation>, Read<Scale>)>::query().filter( !component::<Parent>() & !component::<Rotation>() & !component::<NonUniformScale>() & (maybe_changed::<Translation>() | maybe_changed::<Scale>()), ), ) // Translation + NonUniformScale .with_query( <( Write<LocalToWorld>, Read<Translation>, Read<NonUniformScale>, )>::query() .filter( !component::<Parent>() & !component::<Rotation>() & !component::<Scale>() & (maybe_changed::<Translation>() | maybe_changed::<NonUniformScale>()), ), ) // Rotation + Scale .with_query( <(Write<LocalToWorld>, Read<Rotation>, Read<Scale>)>::query().filter( !component::<Parent>() & !component::<Translation>() & !component::<NonUniformScale>() & (maybe_changed::<Rotation>() | maybe_changed::<Scale>()), ), ) // Rotation + NonUniformScale .with_query( <(Write<LocalToWorld>, Read<Rotation>, Read<NonUniformScale>)>::query().filter( !component::<Parent>() & !component::<Translation>() & !component::<Scale>() & (maybe_changed::<Rotation>() | maybe_changed::<NonUniformScale>()), ), ) // Translation + Rotation + Scale .with_query( <( Write<LocalToWorld>, Read<Translation>, Read<Rotation>, Read<Scale>, )>::query() .filter( !component::<Parent>() & !component::<NonUniformScale>() & (maybe_changed::<Translation>() | maybe_changed::<Rotation>() | maybe_changed::<Scale>()), ), ) // Translation + Rotation + NonUniformScale .with_query( <( Write<LocalToWorld>, Read<Translation>, Read<Rotation>, Read<NonUniformScale>, )>::query() .filter( !component::<Parent>() & !component::<Scale>() & (maybe_changed::<Translation>() | maybe_changed::<Rotation>() | maybe_changed::<NonUniformScale>()), ), ) // Just to issue warnings: Scale + NonUniformScale .with_query( <( Entity, Read<LocalToWorld>, Read<Scale>, Read<NonUniformScale>, )>::query() .filter(!component::<Parent>()), ) .build(move |_commands, world, _, queries| { let (a, b, c, d, e, f, g, h, i, j, k, l) = queries; rayon::scope(|s| { s.spawn(|_| unsafe { // Translation a.for_each_unchecked(world, |(ltw, translation)| { *ltw = LocalToWorld(translation.to_homogeneous()); }); }); s.spawn(|_| unsafe { // Rotation b.for_each_unchecked(world, |(ltw, rotation)| { *ltw = LocalToWorld(rotation.to_homogeneous()); }); }); s.spawn(|_| unsafe { // Scale c.for_each_unchecked(world, |(ltw, scale)| { *ltw = LocalToWorld(Matrix4::new_scaling(scale.0)); }); }); s.spawn(|_| unsafe { // NonUniformScale d.for_each_unchecked(world, |(ltw, non_uniform_scale)| { *ltw = LocalToWorld(Matrix4::new_nonuniform_scaling(&non_uniform_scale.0)); }); }); s.spawn(|_| unsafe { // Translation + Rotation e.for_each_unchecked(world, |(ltw, translation, rotation)| { *ltw = LocalToWorld( rotation .to_homogeneous() .append_translation(&translation.vector), ); }); }); s.spawn(|_| unsafe { // Translation + Scale f.for_each_unchecked(world, |(ltw, translation, scale)| { *ltw = LocalToWorld(translation.to_homogeneous().prepend_scaling(scale.0)); }); }); s.spawn(|_| unsafe { // Translation + NonUniformScale g.for_each_unchecked(world, |(ltw, translation, non_uniform_scale)| { *ltw = LocalToWorld( translation .to_homogeneous() .prepend_nonuniform_scaling(&non_uniform_scale.0), ); }); }); s.spawn(|_| unsafe { // Rotation + Scale h.for_each_unchecked(world, |(ltw, rotation, scale)| { *ltw = LocalToWorld(rotation.to_homogeneous().prepend_scaling(scale.0)); }); }); s.spawn(|_| unsafe { // Rotation + NonUniformScale i.for_each_unchecked(world, |(ltw, rotation, non_uniform_scale)| { *ltw = LocalToWorld( rotation .to_homogeneous() .prepend_nonuniform_scaling(&non_uniform_scale.0), ); }); }); s.spawn(|_| unsafe { // Translation + Rotation + Scale j.for_each_unchecked(world, |(ltw, translation, rotation, scale)| { *ltw = LocalToWorld( rotation .to_homogeneous() .append_translation(&translation.vector) .prepend_scaling(scale.0), ); }); }); s.spawn(|_| unsafe { // Translation + Rotation + NonUniformScale k.for_each_unchecked( world, |(ltw, translation, rotation, non_uniform_scale)| { *ltw = LocalToWorld( rotation .to_homogeneous() .append_translation(&translation.vector) .prepend_nonuniform_scaling(&non_uniform_scale.0), ); }, ); }); // Just to issue warnings: Scale + NonUniformScale l.iter(world) .for_each(|(entity, mut _ltw, _scale, _non_uniform_scale)| { log::warn!( "Entity {:?} has both a Scale and NonUniformScale component.", entity ); }); }); }) } #[cfg(test)] mod test { use super::*; #[test] fn correct_world_transformation() { let _ = env_logger::builder().is_test(true).try_init(); let mut resources = Resources::default(); let mut world = World::default(); let mut schedule = Schedule::builder().add_system(build()).build(); let ltw = LocalToWorld::identity(); let t = Translation::new(1.0, 2.0, 3.0); let r = Rotation::from_euler_angles(1.0, 2.0, 3.0); let s = Scale(2.0); let nus = NonUniformScale::new(1.0, 2.0, 3.0); // Add every combination of transform types. let translation = world.push((ltw, t)); let rotation = world.push((ltw, r)); let scale = world.push((ltw, s)); let non_uniform_scale = world.push((ltw, nus)); let translation_and_rotation = world.push((ltw, t, r)); let translation_and_scale = world.push((ltw, t, s)); let translation_and_nus = world.push((ltw, t, nus)); let rotation_scale = world.push((ltw, r, s)); let rotation_nus = world.push((ltw, r, nus)); let translation_rotation_scale = world.push((ltw, t, r, s)); let translation_rotation_nus = world.push((ltw, t, r, nus)); // Run the system schedule.execute(&mut world, &mut resources); // Verify that each was transformed correctly. assert_eq!( world .entry(translation) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, t.to_homogeneous() ); assert_eq!( world .entry(rotation) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, r.to_homogeneous() ); assert_eq!( world .entry(scale) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, Matrix4::new_scaling(s.0), ); assert_eq!( world .entry(non_uniform_scale) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, Matrix4::new_nonuniform_scaling(&nus.0), ); assert_eq!( world .entry(translation_and_rotation) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, r.to_homogeneous().append_translation(&t.vector), ); assert_eq!( world .entry(translation_and_scale) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, t.to_homogeneous().prepend_scaling(s.0), ); assert_eq!( world .entry(translation_and_nus) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, t.to_homogeneous().prepend_nonuniform_scaling(&nus.0), ); assert_eq!( world .entry(rotation_scale) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, r.to_homogeneous().prepend_scaling(s.0) ); assert_eq!( world .entry(rotation_nus) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, r.to_homogeneous().prepend_nonuniform_scaling(&nus.0) ); assert_eq!( world .entry(translation_rotation_scale) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, r.to_homogeneous() .append_translation(&t.vector) .prepend_scaling(s.0) ); assert_eq!( world .entry(translation_rotation_nus) .unwrap() .get_component::<LocalToWorld>() .unwrap() .0, r.to_homogeneous() .append_translation(&t.vector) .prepend_nonuniform_scaling(&nus.0) ); } }
#[doc = "Reader of register AHB2SECSR"] pub type R = crate::R<u32, super::AHB2SECSR>; #[doc = "Reader of field `SDMMC1SECF`"] pub type SDMMC1SECF_R = crate::R<bool, bool>; #[doc = "Reader of field `OTFDEC1SECF`"] pub type OTFDEC1SECF_R = crate::R<bool, bool>; #[doc = "Reader of field `SRAM2SECF`"] pub type SRAM2SECF_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIOHSECF`"] pub type GPIOHSECF_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIOGSECF`"] pub type GPIOGSECF_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIOFSECF`"] pub type GPIOFSECF_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIOESECF`"] pub type GPIOESECF_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIODSECF`"] pub type GPIODSECF_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIOCSECF`"] pub type GPIOCSECF_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIOBSECF`"] pub type GPIOBSECF_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIOASECF`"] pub type GPIOASECF_R = crate::R<bool, bool>; impl R { #[doc = "Bit 22 - SDMMC1SECF"] #[inline(always)] pub fn sdmmc1secf(&self) -> SDMMC1SECF_R { SDMMC1SECF_R::new(((self.bits >> 22) & 0x01) != 0) } #[doc = "Bit 21 - OTFDEC1SECF"] #[inline(always)] pub fn otfdec1secf(&self) -> OTFDEC1SECF_R { OTFDEC1SECF_R::new(((self.bits >> 21) & 0x01) != 0) } #[doc = "Bit 9 - SRAM2SECF"] #[inline(always)] pub fn sram2secf(&self) -> SRAM2SECF_R { SRAM2SECF_R::new(((self.bits >> 9) & 0x01) != 0) } #[doc = "Bit 7 - GPIOHSECF"] #[inline(always)] pub fn gpiohsecf(&self) -> GPIOHSECF_R { GPIOHSECF_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bit 6 - GPIOGSECF"] #[inline(always)] pub fn gpiogsecf(&self) -> GPIOGSECF_R { GPIOGSECF_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 5 - GPIOFSECF"] #[inline(always)] pub fn gpiofsecf(&self) -> GPIOFSECF_R { GPIOFSECF_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 4 - GPIOESECF"] #[inline(always)] pub fn gpioesecf(&self) -> GPIOESECF_R { GPIOESECF_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 3 - GPIODSECF"] #[inline(always)] pub fn gpiodsecf(&self) -> GPIODSECF_R { GPIODSECF_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 2 - GPIOCSECF"] #[inline(always)] pub fn gpiocsecf(&self) -> GPIOCSECF_R { GPIOCSECF_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 1 - GPIOBSECF"] #[inline(always)] pub fn gpiobsecf(&self) -> GPIOBSECF_R { GPIOBSECF_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 0 - GPIOASECF"] #[inline(always)] pub fn gpioasecf(&self) -> GPIOASECF_R { GPIOASECF_R::new((self.bits & 0x01) != 0) } }
#[doc = "Reader of register AWD2CR"] pub type R = crate::R<u32, super::AWD2CR>; #[doc = "Writer for register AWD2CR"] pub type W = crate::W<u32, super::AWD2CR>; #[doc = "Register AWD2CR `reset()`'s with value 0"] impl crate::ResetValue for super::AWD2CR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "AWD2CH\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum AWD2CH0_A { #[doc = "0: Input channel not monitored by AWDx"] NOTMONITORED = 0, #[doc = "1: Input channel monitored by AWDx"] MONITORED = 1, } impl From<AWD2CH0_A> for bool { #[inline(always)] fn from(variant: AWD2CH0_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `AWD2CH0`"] pub type AWD2CH0_R = crate::R<bool, AWD2CH0_A>; impl AWD2CH0_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> AWD2CH0_A { match self.bits { false => AWD2CH0_A::NOTMONITORED, true => AWD2CH0_A::MONITORED, } } #[doc = "Checks if the value of the field is `NOTMONITORED`"] #[inline(always)] pub fn is_not_monitored(&self) -> bool { *self == AWD2CH0_A::NOTMONITORED } #[doc = "Checks if the value of the field is `MONITORED`"] #[inline(always)] pub fn is_monitored(&self) -> bool { *self == AWD2CH0_A::MONITORED } } #[doc = "Write proxy for field `AWD2CH0`"] pub struct AWD2CH0_W<'a> { w: &'a mut W, } impl<'a> AWD2CH0_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH0_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01); self.w } } #[doc = "AWD2CH"] pub type AWD2CH1_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH1`"] pub type AWD2CH1_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH1`"] pub struct AWD2CH1_W<'a> { w: &'a mut W, } impl<'a> AWD2CH1_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH1_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1); self.w } } #[doc = "AWD2CH"] pub type AWD2CH2_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH2`"] pub type AWD2CH2_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH2`"] pub struct AWD2CH2_W<'a> { w: &'a mut W, } impl<'a> AWD2CH2_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH2_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2); self.w } } #[doc = "AWD2CH"] pub type AWD2CH3_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH3`"] pub type AWD2CH3_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH3`"] pub struct AWD2CH3_W<'a> { w: &'a mut W, } impl<'a> AWD2CH3_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH3_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3); self.w } } #[doc = "AWD2CH"] pub type AWD2CH4_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH4`"] pub type AWD2CH4_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH4`"] pub struct AWD2CH4_W<'a> { w: &'a mut W, } impl<'a> AWD2CH4_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH4_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "AWD2CH"] pub type AWD2CH5_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH5`"] pub type AWD2CH5_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH5`"] pub struct AWD2CH5_W<'a> { w: &'a mut W, } impl<'a> AWD2CH5_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH5_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5); self.w } } #[doc = "AWD2CH"] pub type AWD2CH6_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH6`"] pub type AWD2CH6_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH6`"] pub struct AWD2CH6_W<'a> { w: &'a mut W, } impl<'a> AWD2CH6_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH6_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6); self.w } } #[doc = "AWD2CH"] pub type AWD2CH7_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH7`"] pub type AWD2CH7_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH7`"] pub struct AWD2CH7_W<'a> { w: &'a mut W, } impl<'a> AWD2CH7_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH7_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7); self.w } } #[doc = "AWD2CH"] pub type AWD2CH8_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH8`"] pub type AWD2CH8_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH8`"] pub struct AWD2CH8_W<'a> { w: &'a mut W, } impl<'a> AWD2CH8_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH8_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8); self.w } } #[doc = "AWD2CH"] pub type AWD2CH9_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH9`"] pub type AWD2CH9_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH9`"] pub struct AWD2CH9_W<'a> { w: &'a mut W, } impl<'a> AWD2CH9_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH9_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9); self.w } } #[doc = "AWD2CH"] pub type AWD2CH10_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH10`"] pub type AWD2CH10_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH10`"] pub struct AWD2CH10_W<'a> { w: &'a mut W, } impl<'a> AWD2CH10_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH10_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10); self.w } } #[doc = "AWD2CH"] pub type AWD2CH11_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH11`"] pub type AWD2CH11_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH11`"] pub struct AWD2CH11_W<'a> { w: &'a mut W, } impl<'a> AWD2CH11_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH11_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11); self.w } } #[doc = "AWD2CH"] pub type AWD2CH12_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH12`"] pub type AWD2CH12_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH12`"] pub struct AWD2CH12_W<'a> { w: &'a mut W, } impl<'a> AWD2CH12_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH12_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12); self.w } } #[doc = "AWD2CH"] pub type AWD2CH13_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH13`"] pub type AWD2CH13_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH13`"] pub struct AWD2CH13_W<'a> { w: &'a mut W, } impl<'a> AWD2CH13_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH13_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13); self.w } } #[doc = "AWD2CH"] pub type AWD2CH14_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH14`"] pub type AWD2CH14_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH14`"] pub struct AWD2CH14_W<'a> { w: &'a mut W, } impl<'a> AWD2CH14_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH14_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14); self.w } } #[doc = "AWD2CH"] pub type AWD2CH15_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH15`"] pub type AWD2CH15_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH15`"] pub struct AWD2CH15_W<'a> { w: &'a mut W, } impl<'a> AWD2CH15_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH15_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15); self.w } } #[doc = "AWD2CH"] pub type AWD2CH16_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH16`"] pub type AWD2CH16_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH16`"] pub struct AWD2CH16_W<'a> { w: &'a mut W, } impl<'a> AWD2CH16_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH16_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16); self.w } } #[doc = "AWD2CH"] pub type AWD2CH17_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH17`"] pub type AWD2CH17_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH17`"] pub struct AWD2CH17_W<'a> { w: &'a mut W, } impl<'a> AWD2CH17_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH17_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17); self.w } } #[doc = "AWD2CH"] pub type AWD2CH18_A = AWD2CH0_A; #[doc = "Reader of field `AWD2CH18`"] pub type AWD2CH18_R = crate::R<bool, AWD2CH0_A>; #[doc = "Write proxy for field `AWD2CH18`"] pub struct AWD2CH18_W<'a> { w: &'a mut W, } impl<'a> AWD2CH18_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AWD2CH18_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Input channel not monitored by AWDx"] #[inline(always)] pub fn not_monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::NOTMONITORED) } #[doc = "Input channel monitored by AWDx"] #[inline(always)] pub fn monitored(self) -> &'a mut W { self.variant(AWD2CH0_A::MONITORED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18); self.w } } impl R { #[doc = "Bit 0 - AWD2CH"] #[inline(always)] pub fn awd2ch0(&self) -> AWD2CH0_R { AWD2CH0_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - AWD2CH"] #[inline(always)] pub fn awd2ch1(&self) -> AWD2CH1_R { AWD2CH1_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - AWD2CH"] #[inline(always)] pub fn awd2ch2(&self) -> AWD2CH2_R { AWD2CH2_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - AWD2CH"] #[inline(always)] pub fn awd2ch3(&self) -> AWD2CH3_R { AWD2CH3_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - AWD2CH"] #[inline(always)] pub fn awd2ch4(&self) -> AWD2CH4_R { AWD2CH4_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - AWD2CH"] #[inline(always)] pub fn awd2ch5(&self) -> AWD2CH5_R { AWD2CH5_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 6 - AWD2CH"] #[inline(always)] pub fn awd2ch6(&self) -> AWD2CH6_R { AWD2CH6_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 7 - AWD2CH"] #[inline(always)] pub fn awd2ch7(&self) -> AWD2CH7_R { AWD2CH7_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bit 8 - AWD2CH"] #[inline(always)] pub fn awd2ch8(&self) -> AWD2CH8_R { AWD2CH8_R::new(((self.bits >> 8) & 0x01) != 0) } #[doc = "Bit 9 - AWD2CH"] #[inline(always)] pub fn awd2ch9(&self) -> AWD2CH9_R { AWD2CH9_R::new(((self.bits >> 9) & 0x01) != 0) } #[doc = "Bit 10 - AWD2CH"] #[inline(always)] pub fn awd2ch10(&self) -> AWD2CH10_R { AWD2CH10_R::new(((self.bits >> 10) & 0x01) != 0) } #[doc = "Bit 11 - AWD2CH"] #[inline(always)] pub fn awd2ch11(&self) -> AWD2CH11_R { AWD2CH11_R::new(((self.bits >> 11) & 0x01) != 0) } #[doc = "Bit 12 - AWD2CH"] #[inline(always)] pub fn awd2ch12(&self) -> AWD2CH12_R { AWD2CH12_R::new(((self.bits >> 12) & 0x01) != 0) } #[doc = "Bit 13 - AWD2CH"] #[inline(always)] pub fn awd2ch13(&self) -> AWD2CH13_R { AWD2CH13_R::new(((self.bits >> 13) & 0x01) != 0) } #[doc = "Bit 14 - AWD2CH"] #[inline(always)] pub fn awd2ch14(&self) -> AWD2CH14_R { AWD2CH14_R::new(((self.bits >> 14) & 0x01) != 0) } #[doc = "Bit 15 - AWD2CH"] #[inline(always)] pub fn awd2ch15(&self) -> AWD2CH15_R { AWD2CH15_R::new(((self.bits >> 15) & 0x01) != 0) } #[doc = "Bit 16 - AWD2CH"] #[inline(always)] pub fn awd2ch16(&self) -> AWD2CH16_R { AWD2CH16_R::new(((self.bits >> 16) & 0x01) != 0) } #[doc = "Bit 17 - AWD2CH"] #[inline(always)] pub fn awd2ch17(&self) -> AWD2CH17_R { AWD2CH17_R::new(((self.bits >> 17) & 0x01) != 0) } #[doc = "Bit 18 - AWD2CH"] #[inline(always)] pub fn awd2ch18(&self) -> AWD2CH18_R { AWD2CH18_R::new(((self.bits >> 18) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - AWD2CH"] #[inline(always)] pub fn awd2ch0(&mut self) -> AWD2CH0_W { AWD2CH0_W { w: self } } #[doc = "Bit 1 - AWD2CH"] #[inline(always)] pub fn awd2ch1(&mut self) -> AWD2CH1_W { AWD2CH1_W { w: self } } #[doc = "Bit 2 - AWD2CH"] #[inline(always)] pub fn awd2ch2(&mut self) -> AWD2CH2_W { AWD2CH2_W { w: self } } #[doc = "Bit 3 - AWD2CH"] #[inline(always)] pub fn awd2ch3(&mut self) -> AWD2CH3_W { AWD2CH3_W { w: self } } #[doc = "Bit 4 - AWD2CH"] #[inline(always)] pub fn awd2ch4(&mut self) -> AWD2CH4_W { AWD2CH4_W { w: self } } #[doc = "Bit 5 - AWD2CH"] #[inline(always)] pub fn awd2ch5(&mut self) -> AWD2CH5_W { AWD2CH5_W { w: self } } #[doc = "Bit 6 - AWD2CH"] #[inline(always)] pub fn awd2ch6(&mut self) -> AWD2CH6_W { AWD2CH6_W { w: self } } #[doc = "Bit 7 - AWD2CH"] #[inline(always)] pub fn awd2ch7(&mut self) -> AWD2CH7_W { AWD2CH7_W { w: self } } #[doc = "Bit 8 - AWD2CH"] #[inline(always)] pub fn awd2ch8(&mut self) -> AWD2CH8_W { AWD2CH8_W { w: self } } #[doc = "Bit 9 - AWD2CH"] #[inline(always)] pub fn awd2ch9(&mut self) -> AWD2CH9_W { AWD2CH9_W { w: self } } #[doc = "Bit 10 - AWD2CH"] #[inline(always)] pub fn awd2ch10(&mut self) -> AWD2CH10_W { AWD2CH10_W { w: self } } #[doc = "Bit 11 - AWD2CH"] #[inline(always)] pub fn awd2ch11(&mut self) -> AWD2CH11_W { AWD2CH11_W { w: self } } #[doc = "Bit 12 - AWD2CH"] #[inline(always)] pub fn awd2ch12(&mut self) -> AWD2CH12_W { AWD2CH12_W { w: self } } #[doc = "Bit 13 - AWD2CH"] #[inline(always)] pub fn awd2ch13(&mut self) -> AWD2CH13_W { AWD2CH13_W { w: self } } #[doc = "Bit 14 - AWD2CH"] #[inline(always)] pub fn awd2ch14(&mut self) -> AWD2CH14_W { AWD2CH14_W { w: self } } #[doc = "Bit 15 - AWD2CH"] #[inline(always)] pub fn awd2ch15(&mut self) -> AWD2CH15_W { AWD2CH15_W { w: self } } #[doc = "Bit 16 - AWD2CH"] #[inline(always)] pub fn awd2ch16(&mut self) -> AWD2CH16_W { AWD2CH16_W { w: self } } #[doc = "Bit 17 - AWD2CH"] #[inline(always)] pub fn awd2ch17(&mut self) -> AWD2CH17_W { AWD2CH17_W { w: self } } #[doc = "Bit 18 - AWD2CH"] #[inline(always)] pub fn awd2ch18(&mut self) -> AWD2CH18_W { AWD2CH18_W { w: self } } }