text
stringlengths
8
4.13M
// xfail-stage1 // xfail-stage2 // xfail-stage3 /** A test case for issue #577, which also exposes #588 */ use std; import std::task::join; fn child() { } fn main() { // tasks let t1; let t2; t1 = spawn child(); t2 = spawn child(); assert (t1 == t1); assert (t1 != t2); // ports let p1; let p2; p1 = port[int](); p2 = port[int](); assert (p1 == p1); assert (p1 != p2); // channels let c1; let c2; c1 = chan(p1); c2 = chan(p2); assert (c1 == c1); assert (c1 != c2); join(t1); join(t2); }
mod api_caller; mod live_area_information_provider; mod flight_provider;
use graph::is_tree; use proconio::{input, marker::Usize1}; fn main() { input! { n: usize, m: usize, edges: [(Usize1, Usize1); m], }; if !is_tree(n, &edges) { println!("No"); return; } let mut deg = vec![0; n]; for (u, v) in edges { deg[u] += 1; deg[v] += 1; } if deg.iter().all(|&d| d <= 2) { println!("Yes"); } else { println!("No"); } }
#[macro_use] extern crate derivative; extern crate ggez; extern crate ggez_goodies; extern crate lazy_static; extern crate specs; // extern crate specs_derive; extern crate tiled; extern crate warmy; #[macro_use] extern crate log; extern crate chrono; extern crate failure; extern crate fern; pub mod application; pub mod components; pub mod entities; pub mod game; pub mod input; pub mod map; pub mod resources; pub mod sop; pub mod sprite; pub mod state; pub mod storyboard; pub mod systems; pub mod tween; pub mod util; pub mod world;
use std::collections::{HashMap}; use std::iter::Iterator; #[derive (PartialEq, Eq, Clone, Copy, Debug, Hash)] pub struct Id { id: usize } #[derive (PartialEq)] pub struct Module { id: Id, prelude: bool, dependencies: Vec<Id> } impl Module { pub fn prelude(&self) -> bool { self.prelude } pub fn id(&self) -> Id { self.id } pub fn dependencies(&self) -> &Vec<Id> { &self.dependencies } } pub struct Graph { names: Vec<String>, id: HashMap<String, Id>, modules: HashMap<Id, Module> } impl Graph { pub fn new() -> Graph { Graph { names: Vec::new(), id: HashMap::new(), modules: HashMap::new() } } pub fn register_name(&mut self, name: &str) -> Id { self.id.get(name).cloned().unwrap_or_else(|| { let id = Id { id: self.names.len() }; self.names.push(name.to_string()); self.id.insert(name.to_string(), id); id }) } pub fn register_module(&mut self, id: Id, prelude: bool, dependencies: Vec<Id>) { if self.modules.insert(id, Module { id, prelude, dependencies }).is_some() { panic!("Module for id {} ({}) registered twice.", id.id, self.get_name(id)); } } pub fn get_name(&self, id: Id) -> &String { self.names.get(id.id).unwrap() } pub fn get_module (&self, id: Id) -> Option<&Module> { self.modules.get(&id) } pub fn modules (&self) -> impl Iterator<Item = &Module> { self.modules.values() } pub fn iter_edges<'a> (&'a self) -> impl Iterator<Item = (&'a Module, Id)> + 'a { self.modules.values().flat_map(|m| m.dependencies.iter().map(move |&d| (m, d))) } }
pub struct Solution; impl Solution { pub fn reverse_vowels(s: String) -> String { fn is_vowel(b: u8) -> bool { match b { b'a' | b'e' | b'i' | b'o' | b'u' | b'A' | b'E' | b'I' | b'O' | b'U' => true, _ => false, } } if s.is_empty() { return s; } let mut bytes = s.into_bytes(); let mut i = 0; let mut j = bytes.len() - 1; while i < j { while i < j && !is_vowel(bytes[i]) { i += 1; } while i < j && !is_vowel(bytes[j]) { j -= 1; } if i == j { break; } bytes.swap(i, j); i += 1; j -= 1; } String::from_utf8(bytes).unwrap() } } #[test] fn test0345() { fn case(s: &str, want: &str) { let got = Solution::reverse_vowels(s.to_string()); assert_eq!(got, want); } case("hello", "holle"); case("leetcode", "leotcede"); case("ai", "ia"); case("aA", "Aa"); }
use std::env; use std::str::FromStr; fn sum(x: i32, y: i32) -> i32 { x + y } fn main() { let args: Vec<_> = env::args().collect(); let x = i32::from_str(&args[1]).expect(""); let y = i32::from_str(&args[2]).expect(""); println!("{:?}", sum(x, y)); } #[test] fn test_sum() { assert_eq!(sum(1, 2), 3); assert_eq!(sum(0, 0), 0); }
// Copyright 2022 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::collections::BTreeMap; use std::hash::Hash; use std::sync::Arc; use common_catalog::table_context::TableContext; use common_exception::Result; use crate::optimizer::PhysicalProperty; use crate::optimizer::RelExpr; use crate::optimizer::RelationalProperty; use crate::optimizer::RequiredProperty; use crate::optimizer::Statistics; use crate::plans::Operator; use crate::plans::RelOp; use crate::ColumnSet; use crate::IndexType; use crate::ScalarExpr; #[derive( Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize, Ord, PartialOrd, )] pub struct RuntimeFilterId { id: String, } impl RuntimeFilterId { pub fn new(id: IndexType) -> Self { RuntimeFilterId { id: id.to_string() } } } #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct RuntimeFilterSource { pub left_runtime_filters: BTreeMap<RuntimeFilterId, ScalarExpr>, pub right_runtime_filters: BTreeMap<RuntimeFilterId, ScalarExpr>, } impl RuntimeFilterSource { pub fn used_columns(&self) -> Result<ColumnSet> { let mut used_columns = ColumnSet::new(); for expr in self .left_runtime_filters .iter() .chain(self.right_runtime_filters.iter()) { used_columns.extend(expr.1.used_columns()); } Ok(used_columns) } } impl Operator for RuntimeFilterSource { fn rel_op(&self) -> RelOp { RelOp::RuntimeFilterSource } fn derive_relational_prop(&self, rel_expr: &RelExpr) -> Result<RelationalProperty> { let left_prop = rel_expr.derive_relational_prop_child(0)?; // Derive output columns let output_columns = left_prop.output_columns.clone(); // Derive outer columns let outer_columns = left_prop.outer_columns.clone(); Ok(RelationalProperty { output_columns, outer_columns, used_columns: self.used_columns()?, cardinality: left_prop.cardinality, statistics: Statistics { precise_cardinality: None, column_stats: left_prop.statistics.column_stats, is_accurate: false, }, }) } fn derive_physical_prop(&self, _rel_expr: &RelExpr) -> Result<PhysicalProperty> { todo!() } fn compute_required_prop_child( &self, _ctx: Arc<dyn TableContext>, _rel_expr: &RelExpr, _child_index: usize, _required: &RequiredProperty, ) -> Result<RequiredProperty> { todo!() } }
#[doc = "Reader of register IM"] pub type R = crate::R<u32, super::IM>; #[doc = "Writer for register IM"] pub type W = crate::W<u32, super::IM>; #[doc = "Register IM `reset()`'s with value 0"] impl crate::ResetValue for super::IM { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `MASK0`"] pub type MASK0_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MASK0`"] pub struct MASK0_W<'a> { w: &'a mut W, } impl<'a> MASK0_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 `MASK1`"] pub type MASK1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MASK1`"] pub struct MASK1_W<'a> { w: &'a mut W, } impl<'a> MASK1_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 `MASK2`"] pub type MASK2_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MASK2`"] pub struct MASK2_W<'a> { w: &'a mut W, } impl<'a> MASK2_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 `MASK3`"] pub type MASK3_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MASK3`"] pub struct MASK3_W<'a> { w: &'a mut W, } impl<'a> MASK3_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 } } #[doc = "Reader of field `DCONSS0`"] pub type DCONSS0_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DCONSS0`"] pub struct DCONSS0_W<'a> { w: &'a mut W, } impl<'a> DCONSS0_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 << 16)) | (((value as u32) & 0x01) << 16); self.w } } #[doc = "Reader of field `DCONSS1`"] pub type DCONSS1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DCONSS1`"] pub struct DCONSS1_W<'a> { w: &'a mut W, } impl<'a> DCONSS1_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 << 17)) | (((value as u32) & 0x01) << 17); self.w } } #[doc = "Reader of field `DCONSS2`"] pub type DCONSS2_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DCONSS2`"] pub struct DCONSS2_W<'a> { w: &'a mut W, } impl<'a> DCONSS2_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 << 18)) | (((value as u32) & 0x01) << 18); self.w } } #[doc = "Reader of field `DCONSS3`"] pub type DCONSS3_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DCONSS3`"] pub struct DCONSS3_W<'a> { w: &'a mut W, } impl<'a> DCONSS3_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 << 19)) | (((value as u32) & 0x01) << 19); self.w } } impl R { #[doc = "Bit 0 - SS0 Interrupt Mask"] #[inline(always)] pub fn mask0(&self) -> MASK0_R { MASK0_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - SS1 Interrupt Mask"] #[inline(always)] pub fn mask1(&self) -> MASK1_R { MASK1_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - SS2 Interrupt Mask"] #[inline(always)] pub fn mask2(&self) -> MASK2_R { MASK2_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - SS3 Interrupt Mask"] #[inline(always)] pub fn mask3(&self) -> MASK3_R { MASK3_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 16 - Digital Comparator Interrupt on SS0"] #[inline(always)] pub fn dconss0(&self) -> DCONSS0_R { DCONSS0_R::new(((self.bits >> 16) & 0x01) != 0) } #[doc = "Bit 17 - Digital Comparator Interrupt on SS1"] #[inline(always)] pub fn dconss1(&self) -> DCONSS1_R { DCONSS1_R::new(((self.bits >> 17) & 0x01) != 0) } #[doc = "Bit 18 - Digital Comparator Interrupt on SS2"] #[inline(always)] pub fn dconss2(&self) -> DCONSS2_R { DCONSS2_R::new(((self.bits >> 18) & 0x01) != 0) } #[doc = "Bit 19 - Digital Comparator Interrupt on SS3"] #[inline(always)] pub fn dconss3(&self) -> DCONSS3_R { DCONSS3_R::new(((self.bits >> 19) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - SS0 Interrupt Mask"] #[inline(always)] pub fn mask0(&mut self) -> MASK0_W { MASK0_W { w: self } } #[doc = "Bit 1 - SS1 Interrupt Mask"] #[inline(always)] pub fn mask1(&mut self) -> MASK1_W { MASK1_W { w: self } } #[doc = "Bit 2 - SS2 Interrupt Mask"] #[inline(always)] pub fn mask2(&mut self) -> MASK2_W { MASK2_W { w: self } } #[doc = "Bit 3 - SS3 Interrupt Mask"] #[inline(always)] pub fn mask3(&mut self) -> MASK3_W { MASK3_W { w: self } } #[doc = "Bit 16 - Digital Comparator Interrupt on SS0"] #[inline(always)] pub fn dconss0(&mut self) -> DCONSS0_W { DCONSS0_W { w: self } } #[doc = "Bit 17 - Digital Comparator Interrupt on SS1"] #[inline(always)] pub fn dconss1(&mut self) -> DCONSS1_W { DCONSS1_W { w: self } } #[doc = "Bit 18 - Digital Comparator Interrupt on SS2"] #[inline(always)] pub fn dconss2(&mut self) -> DCONSS2_W { DCONSS2_W { w: self } } #[doc = "Bit 19 - Digital Comparator Interrupt on SS3"] #[inline(always)] pub fn dconss3(&mut self) -> DCONSS3_W { DCONSS3_W { w: self } } }
use anyhow::*; use liblumen_alloc::error; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::trace::Trace; use liblumen_alloc::erts::term::prelude::Term; #[native_implemented::function(erlang:error/2)] pub fn result(reason: Term, arguments: Term) -> exception::Result<Term> { Err(error!( reason, arguments, Trace::capture(), anyhow!("explicit error from Erlang").into() ) .into()) }
#[doc = "Reader of register IF2CMSK"] pub type R = crate::R<u32, super::IF2CMSK>; #[doc = "Writer for register IF2CMSK"] pub type W = crate::W<u32, super::IF2CMSK>; #[doc = "Register IF2CMSK `reset()`'s with value 0"] impl crate::ResetValue for super::IF2CMSK { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `DATAB`"] pub type DATAB_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DATAB`"] pub struct DATAB_W<'a> { w: &'a mut W, } impl<'a> DATAB_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 `DATAA`"] pub type DATAA_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DATAA`"] pub struct DATAA_W<'a> { w: &'a mut W, } impl<'a> DATAA_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 `NEWDAT`"] pub type NEWDAT_R = crate::R<bool, bool>; #[doc = "Write proxy for field `NEWDAT`"] pub struct NEWDAT_W<'a> { w: &'a mut W, } impl<'a> NEWDAT_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 `TXRQST`"] pub type TXRQST_R = crate::R<bool, bool>; #[doc = "Write proxy for field `TXRQST`"] pub struct TXRQST_W<'a> { w: &'a mut W, } impl<'a> TXRQST_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 `CLRINTPND`"] pub type CLRINTPND_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CLRINTPND`"] pub struct CLRINTPND_W<'a> { w: &'a mut W, } impl<'a> CLRINTPND_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 } } #[doc = "Reader of field `CONTROL`"] pub type CONTROL_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CONTROL`"] pub struct CONTROL_W<'a> { w: &'a mut W, } impl<'a> CONTROL_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 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "Reader of field `ARB`"] pub type ARB_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ARB`"] pub struct ARB_W<'a> { w: &'a mut W, } impl<'a> ARB_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 << 5)) | (((value as u32) & 0x01) << 5); self.w } } #[doc = "Reader of field `MASK`"] pub type MASK_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MASK`"] pub struct MASK_W<'a> { w: &'a mut W, } impl<'a> MASK_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 << 6)) | (((value as u32) & 0x01) << 6); self.w } } #[doc = "Reader of field `WRNRD`"] pub type WRNRD_R = crate::R<bool, bool>; #[doc = "Write proxy for field `WRNRD`"] pub struct WRNRD_W<'a> { w: &'a mut W, } impl<'a> WRNRD_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 << 7)) | (((value as u32) & 0x01) << 7); self.w } } impl R { #[doc = "Bit 0 - Access Data Byte 4 to 7"] #[inline(always)] pub fn datab(&self) -> DATAB_R { DATAB_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Access Data Byte 0 to 3"] #[inline(always)] pub fn dataa(&self) -> DATAA_R { DATAA_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - Access New Data"] #[inline(always)] pub fn newdat(&self) -> NEWDAT_R { NEWDAT_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 2 - Access Transmission Request"] #[inline(always)] pub fn txrqst(&self) -> TXRQST_R { TXRQST_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - Clear Interrupt Pending Bit"] #[inline(always)] pub fn clrintpnd(&self) -> CLRINTPND_R { CLRINTPND_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - Access Control Bits"] #[inline(always)] pub fn control(&self) -> CONTROL_R { CONTROL_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - Access Arbitration Bits"] #[inline(always)] pub fn arb(&self) -> ARB_R { ARB_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 6 - Access Mask Bits"] #[inline(always)] pub fn mask(&self) -> MASK_R { MASK_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 7 - Write, Not Read"] #[inline(always)] pub fn wrnrd(&self) -> WRNRD_R { WRNRD_R::new(((self.bits >> 7) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - Access Data Byte 4 to 7"] #[inline(always)] pub fn datab(&mut self) -> DATAB_W { DATAB_W { w: self } } #[doc = "Bit 1 - Access Data Byte 0 to 3"] #[inline(always)] pub fn dataa(&mut self) -> DATAA_W { DATAA_W { w: self } } #[doc = "Bit 2 - Access New Data"] #[inline(always)] pub fn newdat(&mut self) -> NEWDAT_W { NEWDAT_W { w: self } } #[doc = "Bit 2 - Access Transmission Request"] #[inline(always)] pub fn txrqst(&mut self) -> TXRQST_W { TXRQST_W { w: self } } #[doc = "Bit 3 - Clear Interrupt Pending Bit"] #[inline(always)] pub fn clrintpnd(&mut self) -> CLRINTPND_W { CLRINTPND_W { w: self } } #[doc = "Bit 4 - Access Control Bits"] #[inline(always)] pub fn control(&mut self) -> CONTROL_W { CONTROL_W { w: self } } #[doc = "Bit 5 - Access Arbitration Bits"] #[inline(always)] pub fn arb(&mut self) -> ARB_W { ARB_W { w: self } } #[doc = "Bit 6 - Access Mask Bits"] #[inline(always)] pub fn mask(&mut self) -> MASK_W { MASK_W { w: self } } #[doc = "Bit 7 - Write, Not Read"] #[inline(always)] pub fn wrnrd(&mut self) -> WRNRD_W { WRNRD_W { w: self } } }
use cid::Cid; use core::fmt; mod dir_builder; use dir_builder::DirBuilder; mod iter; pub use iter::{OwnedTreeNode, PostOrderIterator, TreeNode}; mod buffered; pub use buffered::BufferingTreeBuilder; mod custom_pb; use custom_pb::CustomFlatUnixFs; enum Entry { Leaf(Leaf), Directory(DirBuilder), } impl fmt::Debug for Entry { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use Entry::*; match self { Leaf(leaf) => write!(fmt, "Leaf {{ {:?} }}", leaf), Directory(_) => write!(fmt, "DirBuilder {{ .. }}"), } } } impl Entry { fn as_dir_builder(&mut self) -> Result<&mut DirBuilder, ()> { use Entry::*; match self { Directory(ref mut d) => Ok(d), _ => Err(()), } } } struct Leaf { link: Cid, total_size: u64, } impl fmt::Debug for Leaf { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "{}, {}", self.link, self.total_size) } } /// Configuration for customizing how the tree is built. #[derive(Debug, Clone)] pub struct TreeOptions { block_size_limit: Option<u64>, wrap_with_directory: bool, } impl Default for TreeOptions { fn default() -> Self { TreeOptions { // this is just a guess; our bitswap message limit is a bit more block_size_limit: Some(512 * 1024), wrap_with_directory: false, } } } impl TreeOptions { /// Overrides the default directory block size limit. If the size limit is set to `None`, no /// directory will be too large. pub fn block_size_limit(&mut self, limit: Option<u64>) { self.block_size_limit = limit; } /// When true, allow multiple top level entries, otherwise error on the second entry. /// Defaults to false. pub fn wrap_with_directory(&mut self) { self.wrap_with_directory = true; } } /// Tree building failure cases. #[derive(Debug)] pub enum TreeBuildingFailed { /// The given full path started with a slash; paths in the `/add` convention are not rooted. RootedPath(String), /// The given full path contained an empty segment. RepeatSlashesInPath(String), /// The given full path ends in slash. PathEndsInSlash(String), /// If the `BufferingTreeBuilder` was created without `TreeOptions` with the option /// `wrap_with_directory` enabled, then there can be only a single element at the root. TooManyRootLevelEntries, /// The given full path had already been added. DuplicatePath(String), /// The given full path had already been added as a link to an opaque entry. LeafAsDirectory(String), } impl fmt::Display for TreeBuildingFailed { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use TreeBuildingFailed::*; match self { RootedPath(s) => write!(fmt, "path is rooted: {:?}", s), RepeatSlashesInPath(s) => write!(fmt, "path contains repeat slashes: {:?}", s), PathEndsInSlash(s) => write!(fmt, "path ends in a slash: {:?}", s), TooManyRootLevelEntries => write!( fmt, "multiple root level entries while configured wrap_with_directory = false" ), // TODO: perhaps we should allow adding two leafs with the same Cid? DuplicatePath(s) => write!(fmt, "path exists already: {:?}", s), LeafAsDirectory(s) => write!( fmt, "attempted to use already added leaf as a subdirectory: {:?}", s ), } } } impl std::error::Error for TreeBuildingFailed {} /// Failure cases for `PostOrderIterator` creating the tree dag-pb nodes. #[derive(Debug)] pub enum TreeConstructionFailed { /// Failed to serialize the protobuf node for the directory Protobuf(quick_protobuf::Error), /// The resulting directory would be too large and HAMT sharding is yet to be implemented or /// denied. TooLargeBlock(u64), } impl fmt::Display for TreeConstructionFailed { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use TreeConstructionFailed::*; match self { Protobuf(e) => write!(fmt, "serialization failed: {}", e), TooLargeBlock(size) => write!(fmt, "attempted to create block of {} bytes", size), } } } impl std::error::Error for TreeConstructionFailed {} #[derive(Debug)] struct NamedLeaf(String, Cid, u64);
//! Logic for buffering record batches for gap filling. use std::sync::Arc; use arrow::{ array::ArrayRef, record_batch::RecordBatch, row::{RowConverter, Rows, SortField}, }; use datafusion::error::{DataFusionError, Result}; use hashbrown::HashSet; use super::{params::GapFillParams, FillStrategy}; /// Encapsulate the logic around how to buffer input records. /// /// If there are no columns with [`FillStrategy::LinearInterpolate`], then /// we need to buffer up to the last input row that might appear in the output, plus /// one additional row. /// /// However, if there are columns filled via interpolation, then we need /// to ensure that we read ahead far enough to a non-null value, or a change /// of group columns, in the columns being interpolated. /// /// [`FillStrategy::LinearInterpolate`]: super::FillStrategy::LinearInterpolate /// [`GapFillStream`]: super::stream::GapFillStream pub(super) struct BufferedInput { /// Indexes of group columns in the schema (not including time). group_cols: Vec<usize>, /// Indexes of aggregate columns filled via interpolation. interpolate_cols: Vec<usize>, /// Buffered records from the input stream. batches: Vec<RecordBatch>, /// When gap filling with interpolated values, this row converter /// is used to compare rows to see if group columns have changed. row_converter: Option<RowConverter>, /// When gap filling with interpolated values, cache a row-oriented /// representation of the last row that may appear in the output so /// it doesn't need to be computed more than once. last_output_row: Option<Rows>, } impl BufferedInput { pub(super) fn new(params: &GapFillParams, group_cols: Vec<usize>) -> Self { let interpolate_cols = params .fill_strategy .iter() .filter_map(|(col_offset, fs)| { (fs == &FillStrategy::LinearInterpolate).then_some(*col_offset) }) .collect::<Vec<usize>>(); Self { group_cols, interpolate_cols, batches: vec![], row_converter: None, last_output_row: None, } } /// Add a new batch of buffered records from the input stream. pub(super) fn push(&mut self, batch: RecordBatch) { self.batches.push(batch); } /// Transfer ownership of the buffered record batches to the caller for /// processing. pub(super) fn take(&mut self) -> Vec<RecordBatch> { self.last_output_row = None; std::mem::take(&mut self.batches) } /// Determine if we need more input before we start processing. pub(super) fn need_more(&mut self, last_output_row_offset: usize) -> Result<bool> { let record_count: usize = self.batches.iter().map(|rb| rb.num_rows()).sum(); // min number of rows needed is the number of rows up to and including // the last row that may appear in the output, plus one more row. let min_needed = last_output_row_offset + 2; if record_count < min_needed { return Ok(true); } else if self.interpolate_cols.is_empty() { return Ok(false); } // Check to see if the last row that might appear in the output // has a different group column values than the last buffered row. // If they are different, then we have enough input to start. let (last_output_batch_offset, last_output_row_offset) = self .find_row_idx(last_output_row_offset) .expect("checked record count"); if self.group_columns_changed((last_output_batch_offset, last_output_row_offset))? { return Ok(false); } // Now check if there are non-null values in the columns being interpolated. // We skip over the batches that come before the one that contains the last // possible output row. We start with the last buffered batch, so we can avoid // having to slice unless necessary. let mut cols_that_need_more = HashSet::<usize>::from_iter(self.interpolate_cols.iter().cloned()); let mut to_remove = vec![]; for (i, batch) in self .batches .iter() .enumerate() .skip(last_output_batch_offset) .rev() { for col_offset in cols_that_need_more.clone() { // If this is the batch containing the last possible output row, slice the // array so we are just looking at that value and the ones after. let array = batch.column(col_offset); let array = if i == last_output_batch_offset { let length = array.len() - last_output_row_offset; batch .column(col_offset) .slice(last_output_row_offset, length) } else { Arc::clone(array) }; if array.null_count() < array.len() { to_remove.push(col_offset); } } to_remove.drain(..).for_each(|c| { cols_that_need_more.remove(&c); }); if cols_that_need_more.is_empty() { break; } } Ok(!cols_that_need_more.is_empty()) } /// Check to see if the group column values have changed between the last row /// that may be in the output and the last buffered input row. /// /// This method uses the row-oriented representation of Arrow data from [`arrow::row`] to /// compare rows in different record batches. /// /// [`arrow::row`]: https://docs.rs/arrow-row/36.0.0/arrow_row/index.html fn group_columns_changed(&mut self, last_output_row_idx: (usize, usize)) -> Result<bool> { if self.group_cols.is_empty() { return Ok(false); } let last_buffered_row_idx = self.last_buffered_row_idx(); if last_output_row_idx == last_buffered_row_idx { // the output row is also the last buffered row, // so there is nothing to compare. return Ok(false); } let last_input_rows = self.convert_row(self.last_buffered_row_idx())?; let last_row_in_output = self.last_output_row(last_output_row_idx)?; Ok(last_row_in_output.row(0) != last_input_rows.row(0)) } /// Get a row converter for comparing records. Keep it in [`Self::row_converter`] /// to avoid creating it multiple times. fn get_row_converter(&mut self) -> Result<&mut RowConverter> { if self.row_converter.is_none() { let batch = self.batches.first().expect("at least one batch"); let sort_fields = self .group_cols .iter() .map(|c| SortField::new(batch.column(*c).data_type().clone())) .collect(); let row_converter = RowConverter::new(sort_fields).map_err(DataFusionError::ArrowError)?; self.row_converter = Some(row_converter); } Ok(self.row_converter.as_mut().expect("cannot be none")) } /// Convert a row to row-oriented format for easy comparison. fn convert_row(&mut self, row_idxs: (usize, usize)) -> Result<Rows> { let batch = &self.batches[row_idxs.0]; let columns: Vec<ArrayRef> = self .group_cols .iter() .map(|col_idx| batch.column(*col_idx).slice(row_idxs.1, 1)) .collect(); self.get_row_converter()? .convert_columns(&columns) .map_err(DataFusionError::ArrowError) } /// Returns the row-oriented representation of the last buffered row that may appear in the next /// output batch. Since this row may be used multiple times, cache it in `self` to /// avoid computing it multiple times. fn last_output_row(&mut self, idxs: (usize, usize)) -> Result<&Rows> { if self.last_output_row.is_none() { let rows = self.convert_row(idxs)?; self.last_output_row = Some(rows); } Ok(self.last_output_row.as_ref().expect("cannot be none")) } /// Return the `(batch_idx, row_idx)` of the last buffered row. fn last_buffered_row_idx(&self) -> (usize, usize) { let last_batch_len = self.batches.last().unwrap().num_rows(); (self.batches.len() - 1, last_batch_len - 1) } /// Return the `(batch_idx, row_idx)` of the `nth` row. fn find_row_idx(&self, mut nth: usize) -> Option<(usize, usize)> { let mut idx = None; for (i, batch) in self.batches.iter().enumerate() { if nth >= batch.num_rows() { nth -= batch.num_rows() } else { idx = Some((i, nth)); break; } } idx } } #[cfg(test)] mod tests { use std::collections::VecDeque; use arrow_util::test_util::batches_to_lines; use super::*; use crate::exec::gapfill::exec_tests::TestRecords; fn test_records(batch_size: usize) -> VecDeque<RecordBatch> { let records = TestRecords { group_cols: vec![ std::iter::repeat(Some("a")).take(12).collect(), std::iter::repeat(Some("b")) .take(6) .chain(std::iter::repeat(Some("c")).take(6)) .collect(), ], time_col: (0..12).map(|i| Some(1000 + i * 5)).take(12).collect(), agg_cols: vec![ vec![ Some(1), None, None, None, None, None, None, None, None, None, None, Some(10), ], vec![ Some(2), None, None, None, None, None, None, None, Some(20), None, None, None, ], (0..12).map(Some).collect(), ], input_batch_size: batch_size, }; TryInto::<Vec<RecordBatch>>::try_into(records) .unwrap() .into() } fn test_params() -> GapFillParams { GapFillParams { stride: 50_000_000, first_ts: Some(1_000_000_000), last_ts: 1_055_000_000, fill_strategy: [ (3, FillStrategy::LinearInterpolate), (4, FillStrategy::LinearInterpolate), ] .into(), } } // This test is just here so it's clear what the // test data is #[test] fn test_test_records() { let batch = test_records(1000).pop_front().unwrap(); let actual = batches_to_lines(&[batch]); insta::assert_yaml_snapshot!(actual, @r###" --- - +----+----+--------------------------+----+----+----+ - "| g0 | g1 | time | a0 | a1 | a2 |" - +----+----+--------------------------+----+----+----+ - "| a | b | 1970-01-01T00:00:01Z | 1 | 2 | 0 |" - "| a | b | 1970-01-01T00:00:01.005Z | | | 1 |" - "| a | b | 1970-01-01T00:00:01.010Z | | | 2 |" - "| a | b | 1970-01-01T00:00:01.015Z | | | 3 |" - "| a | b | 1970-01-01T00:00:01.020Z | | | 4 |" - "| a | b | 1970-01-01T00:00:01.025Z | | | 5 |" - "| a | c | 1970-01-01T00:00:01.030Z | | | 6 |" - "| a | c | 1970-01-01T00:00:01.035Z | | | 7 |" - "| a | c | 1970-01-01T00:00:01.040Z | | 20 | 8 |" - "| a | c | 1970-01-01T00:00:01.045Z | | | 9 |" - "| a | c | 1970-01-01T00:00:01.050Z | | | 10 |" - "| a | c | 1970-01-01T00:00:01.055Z | 10 | | 11 |" - +----+----+--------------------------+----+----+----+ "###); } #[test] fn no_group_no_interpolate() { let batch_size = 3; let mut params = test_params(); params.fill_strategy = [].into(); let mut buffered_input = BufferedInput::new(&params, vec![]); let mut batches = test_records(batch_size); // There are no rows, so that is less than the batch size, // it needs more. assert!(buffered_input.need_more(batch_size - 1).unwrap()); // There are now 3 rows, still less than batch_size + 1, // so it needs more. buffered_input.push(batches.pop_front().unwrap()); assert!(buffered_input.need_more(batch_size - 1).unwrap()); // We now have batch_size * 2, records, which is enough. buffered_input.push(batches.pop_front().unwrap()); assert!(!buffered_input.need_more(batch_size - 1).unwrap()); } #[test] fn no_group() { let batch_size = 3; let params = test_params(); let mut buffered_input = BufferedInput::new(&params, vec![]); let mut batches = test_records(batch_size); // There are no rows, so that is less than the batch size, // it needs more. assert!(buffered_input.need_more(batch_size - 1).unwrap()); // There are now 3 rows, still less than batch_size + 1, // so it needs more. buffered_input.push(batches.pop_front().unwrap()); assert!(buffered_input.need_more(batch_size - 1).unwrap()); // There are now 6 rows, if we were not interpolating, // this would be enough. buffered_input.push(batches.pop_front().unwrap()); // If we are interpolating, there are no non null values // at offset 5. assert!(buffered_input.need_more(batch_size - 1).unwrap()); // Push more rows, now totaling 9. buffered_input.push(batches.pop_front().unwrap()); assert!(buffered_input.need_more(batch_size - 1).unwrap()); // Column `a1` has a non-null value at offset 8. // If that were the only column being interpolated, we would have enough. // 12 rows, with non-null values in both columns being interpolated. buffered_input.push(batches.pop_front().unwrap()); assert!(!buffered_input.need_more(batch_size - 1).unwrap()); } #[test] fn with_group() { let params = test_params(); let group_cols = vec![0, 1]; let mut buffered_input = BufferedInput::new(&params, group_cols); let batch_size = 3; let mut batches = test_records(batch_size); // no rows assert!(buffered_input.need_more(batch_size - 1).unwrap()); // 3 rows buffered_input.push(batches.pop_front().unwrap()); assert!(buffered_input.need_more(batch_size - 1).unwrap()); // 6 rows buffered_input.push(batches.pop_front().unwrap()); assert!(buffered_input.need_more(batch_size - 1).unwrap()); // 9 rows (series changes here) buffered_input.push(batches.pop_front().unwrap()); assert!(!buffered_input.need_more(batch_size - 1).unwrap()); } }
/// Prints to [`stdout`][crate::stdout]. /// /// Equivalent to the [`println!`] macro except that a newline is not printed at /// the end of the message. /// /// Note that stdout is frequently line-buffered by default so it may be /// necessary to use [`std::io::Write::flush()`] to ensure the output is emitted /// immediately. /// /// **NOTE:** The `print!` macro will lock the standard output on each call. If you call /// `print!` within a hot loop, this behavior may be the bottleneck of the loop. /// To avoid this, lock stdout with [`AutoStream::lock`][crate::AutoStream::lock]: /// ``` /// # #[cfg(feature = "auto")] { /// use std::io::Write as _; /// /// let mut lock = anstream::stdout().lock(); /// write!(lock, "hello world").unwrap(); /// # } /// ``` /// /// Use `print!` only for the primary output of your program. Use /// [`eprint!`] instead to print error and progress messages. /// /// # Panics /// /// Panics if writing to `stdout` fails for any reason **except** broken pipe. /// /// Writing to non-blocking stdout can cause an error, which will lead /// this macro to panic. /// /// # Examples /// /// ``` /// # #[cfg(feature = "auto")] { /// use std::io::Write as _; /// use anstream::print; /// use anstream::stdout; /// /// print!("this "); /// print!("will "); /// print!("be "); /// print!("on "); /// print!("the "); /// print!("same "); /// print!("line "); /// /// stdout().flush().unwrap(); /// /// print!("this string has a newline, why not choose println! instead?\n"); /// /// stdout().flush().unwrap(); /// # } /// ``` #[cfg(feature = "auto")] #[macro_export] macro_rules! print { ($($arg:tt)*) => {{ use std::io::Write as _; let mut stream = $crate::stdout(); match ::std::write!(&mut stream, $($arg)*) { Err(e) if e.kind() != ::std::io::ErrorKind::BrokenPipe => { ::std::panic!("failed printing to stdout: {e}"); } Err(_) | Ok(_) => {} } }}; } /// Prints to [`stdout`][crate::stdout], with a newline. /// /// On all platforms, the newline is the LINE FEED character (`\n`/`U+000A`) alone /// (no additional CARRIAGE RETURN (`\r`/`U+000D`)). /// /// This macro uses the same syntax as [`format!`], but writes to the standard output instead. /// See [`std::fmt`] for more information. /// /// **NOTE:** The `println!` macro will lock the standard output on each call. If you call /// `println!` within a hot loop, this behavior may be the bottleneck of the loop. /// To avoid this, lock stdout with [`AutoStream::lock`][crate::AutoStream::lock]: /// ``` /// # #[cfg(feature = "auto")] { /// use std::io::Write as _; /// /// let mut lock = anstream::stdout().lock(); /// writeln!(lock, "hello world").unwrap(); /// # } /// ``` /// /// Use `println!` only for the primary output of your program. Use /// [`eprintln!`] instead to print error and progress messages. /// /// # Panics /// /// Panics if writing to `stdout` fails for any reason **except** broken pipe. /// /// Writing to non-blocking stdout can cause an error, which will lead /// this macro to panic. /// /// # Examples /// /// ``` /// # #[cfg(feature = "auto")] { /// use anstream::println; /// /// println!(); // prints just a newline /// println!("hello there!"); /// println!("format {} arguments", "some"); /// let local_variable = "some"; /// println!("format {local_variable} arguments"); /// # } /// ``` #[cfg(feature = "auto")] #[macro_export] macro_rules! println { () => { $crate::print!("\n") }; ($($arg:tt)*) => {{ use std::io::Write as _; let mut stream = $crate::stdout(); match ::std::writeln!(&mut stream, $($arg)*) { Err(e) if e.kind() != ::std::io::ErrorKind::BrokenPipe => { ::std::panic!("failed printing to stdout: {e}"); } Err(_) | Ok(_) => {} } }}; } /// Prints to [`stderr`][crate::stderr]. /// /// Equivalent to the [`print!`] macro, except that output goes to /// `stderr` instead of `stdout`. See [`print!`] for /// example usage. /// /// Use `eprint!` only for error and progress messages. Use `print!` /// instead for the primary output of your program. /// /// # Panics /// /// Panics if writing to `stderr` fails for any reason **except** broken pipe. /// /// Writing to non-blocking stdout can cause an error, which will lead /// this macro to panic. /// /// # Examples /// /// ``` /// # #[cfg(feature = "auto")] { /// use anstream::eprint; /// /// eprint!("Error: Could not complete task"); /// # } /// ``` #[cfg(feature = "auto")] #[macro_export] macro_rules! eprint { ($($arg:tt)*) => {{ use std::io::Write as _; let mut stream = $crate::stderr(); match ::std::write!(&mut stream, $($arg)*) { Err(e) if e.kind() != ::std::io::ErrorKind::BrokenPipe => { ::std::panic!("failed printing to stdout: {e}"); } Err(_) | Ok(_) => {} } }}; } /// Prints to [`stderr`][crate::stderr], with a newline. /// /// Equivalent to the [`println!`] macro, except that output goes to /// `stderr` instead of `stdout`. See [`println!`] for /// example usage. /// /// Use `eprintln!` only for error and progress messages. Use `println!` /// instead for the primary output of your program. /// /// # Panics /// /// Panics if writing to `stderr` fails for any reason **except** broken pipe. /// /// Writing to non-blocking stdout can cause an error, which will lead /// this macro to panic. /// /// # Examples /// /// ``` /// # #[cfg(feature = "auto")] { /// use anstream::eprintln; /// /// eprintln!("Error: Could not complete task"); /// # } /// ``` #[cfg(feature = "auto")] #[macro_export] macro_rules! eprintln { () => { $crate::eprint!("\n") }; ($($arg:tt)*) => {{ use std::io::Write as _; let mut stream = $crate::stderr(); match ::std::writeln!(&mut stream, $($arg)*) { Err(e) if e.kind() != ::std::io::ErrorKind::BrokenPipe => { ::std::panic!("failed printing to stdout: {e}"); } Err(_) | Ok(_) => {} } }}; } /// Panics the current thread. /// /// This allows a program to terminate immediately and provide feedback /// to the caller of the program. /// /// This macro is the perfect way to assert conditions in example code and in /// tests. `panic!` is closely tied with the `unwrap` method of both /// [`Option`][ounwrap] and [`Result`][runwrap] enums. Both implementations call /// `panic!` when they are set to [`None`] or [`Err`] variants. /// /// When using `panic!()` you can specify a string payload, that is built using /// the [`format!`] syntax. That payload is used when injecting the panic into /// the calling Rust thread, causing the thread to panic entirely. /// /// The behavior of the default `std` hook, i.e. the code that runs directly /// after the panic is invoked, is to print the message payload to /// `stderr` along with the file/line/column information of the `panic!()` /// call. You can override the panic hook using [`std::panic::set_hook()`]. /// Inside the hook a panic can be accessed as a `&dyn Any + Send`, /// which contains either a `&str` or `String` for regular `panic!()` invocations. /// To panic with a value of another other type, [`panic_any`] can be used. /// /// See also the macro [`compile_error!`], for raising errors during compilation. /// /// # When to use `panic!` vs `Result` /// /// The Rust language provides two complementary systems for constructing / /// representing, reporting, propagating, reacting to, and discarding errors. These /// responsibilities are collectively known as "error handling." `panic!` and /// `Result` are similar in that they are each the primary interface of their /// respective error handling systems; however, the meaning these interfaces attach /// to their errors and the responsibilities they fulfill within their respective /// error handling systems differ. /// /// The `panic!` macro is used to construct errors that represent a bug that has /// been detected in your program. With `panic!` you provide a message that /// describes the bug and the language then constructs an error with that message, /// reports it, and propagates it for you. /// /// `Result` on the other hand is used to wrap other types that represent either /// the successful result of some computation, `Ok(T)`, or error types that /// represent an anticipated runtime failure mode of that computation, `Err(E)`. /// `Result` is used alongside user defined types which represent the various /// anticipated runtime failure modes that the associated computation could /// encounter. `Result` must be propagated manually, often with the the help of the /// `?` operator and `Try` trait, and they must be reported manually, often with /// the help of the `Error` trait. /// /// For more detailed information about error handling check out the [book] or the /// [`std::result`] module docs. /// /// [ounwrap]: Option::unwrap /// [runwrap]: Result::unwrap /// [`std::panic::set_hook()`]: ../std/panic/fn.set_hook.html /// [`panic_any`]: ../std/panic/fn.panic_any.html /// [`Box`]: ../std/boxed/struct.Box.html /// [`Any`]: crate::any::Any /// [`format!`]: ../std/macro.format.html /// [book]: ../book/ch09-00-error-handling.html /// [`std::result`]: ../std/result/index.html /// /// # Current implementation /// /// If the main thread panics it will terminate all your threads and end your /// program with code `101`. /// /// # Examples /// /// ```should_panic /// # #![allow(unreachable_code)] /// use anstream::panic; /// panic!(); /// panic!("this is a terrible mistake!"); /// panic!("this is a {} {message}", "fancy", message = "message"); /// ``` #[cfg(feature = "auto")] #[macro_export] macro_rules! panic { () => { ::std::panic!() }; ($($arg:tt)*) => {{ use std::io::Write as _; let panic_stream = std::io::stderr(); let choice = $crate::AutoStream::choice(&panic_stream); let buffer = $crate::Buffer::new(); let mut stream = $crate::AutoStream::new(buffer, choice); // Ignore errors rather than panic let _ = ::std::write!(&mut stream, $($arg)*); let buffer = stream.into_inner(); // Should be UTF-8 but not wanting to panic let buffer = String::from_utf8_lossy(buffer.as_bytes()).into_owned(); ::std::panic!("{}", buffer) }}; }
// 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::{ formatting::{format_parts, get_child_listing, get_locations, Formatter}, location::InspectLocation, options::PathFormat, result::IqueryResult, }, failure::{bail, Error}, fuchsia_inspect::reader::{ArrayValue, NodeHierarchy, Property}, nom::HexDisplay, num_traits::Bounded, std::{ fmt, ops::{Add, AddAssign, MulAssign}, }, }; const INDENT: usize = 2; const HEX_DISPLAY_CHUNK_SIZE: usize = 16; pub struct TextFormatter { path_format: PathFormat, max_depth: Option<u64>, sort: bool, } impl Formatter for TextFormatter { fn new(path_format: PathFormat, max_depth: Option<u64>, sort: bool) -> Self { Self { path_format, max_depth, sort } } fn format_recursive(&self, results: Vec<IqueryResult>) -> Result<String, Error> { let mut outputs = vec![]; for result in results.into_iter() { let mut hierarchy = match result.get_query_hierarchy() { None => bail!("No node hierachy found"), Some(h) => h.clone(), }; if self.max_depth.is_none() { hierarchy.children = vec![]; } if self.sort { hierarchy.sort(); } let path = result.location.query_path(); outputs.push(self.output_hierarchy(hierarchy, &result.location, &path, 0)); } Ok(outputs.join("\n")) } fn format_locations(&self, results: Vec<IqueryResult>) -> Result<String, Error> { let mut outputs = vec![]; for mut result in results.into_iter() { if self.sort { result.sort_hierarchy(); } if self.max_depth.is_none() && result.is_loaded() { let locations = get_locations(result.hierarchy.unwrap(), &result.location, &self.path_format); outputs.extend(locations.into_iter().map(|location| format!("{}", location))); } else { outputs .push(format!("{}", format_parts(&result.location, &self.path_format, &vec![]))) } } Ok(outputs.join("\n")) } fn format_child_listing(&self, results: Vec<IqueryResult>) -> Result<String, Error> { Ok(get_child_listing(results, self.sort, &self.path_format).join("\n")) } } trait NumberFormat { fn format(&self) -> String; } impl TextFormatter { fn output_hierarchy( &self, node_hierarchy: NodeHierarchy, location: &InspectLocation, path: &[String], indent: usize, ) -> String { let mut lines = vec![]; let name_indent = " ".repeat(INDENT * indent); let value_indent = " ".repeat(INDENT * (indent + 1)); lines.push(self.output_name(&name_indent, &path, &node_hierarchy.name, location)); lines.extend(node_hierarchy.properties.into_iter().map(|property| match property { Property::String(name, value) => format!("{}{} = {}", value_indent, name, value), Property::Int(name, value) => format!("{}{} = {}", value_indent, name, value), Property::Uint(name, value) => format!("{}{} = {}", value_indent, name, value), Property::Double(name, value) => format!("{}{} = {:.6}", value_indent, name, value), Property::Bytes(name, array) => { let byte_str = array.to_hex(HEX_DISPLAY_CHUNK_SIZE); format!("{}{} = Binary:\n{}", value_indent, name, byte_str.trim()) } Property::IntArray(name, array) => self.output_array(&value_indent, &name, &array), Property::UintArray(name, array) => self.output_array(&value_indent, &name, &array), Property::DoubleArray(name, array) => self.output_array(&value_indent, &name, &array), })); let mut child_path = path.to_vec(); child_path.push(node_hierarchy.name); lines.extend( node_hierarchy .children .into_iter() .map(|child| self.output_hierarchy(child, location, &child_path, indent + 1)), ); lines.join("\n") } fn output_name( &self, name_indent: &str, path: &[String], name: &str, location: &InspectLocation, ) -> String { let output = match self.path_format { PathFormat::Undefined => name.to_string(), _ => { let mut parts = path.to_vec(); parts.push(name.to_string()); format_parts(location, &self.path_format, &parts) } }; format!("{}{}:", name_indent, output) } fn output_array< T: AddAssign + MulAssign + Copy + Add<Output = T> + fmt::Display + NumberFormat + Bounded, >( &self, value_indent: &str, name: &str, array: &ArrayValue<T>, ) -> String { let content = match array.buckets() { None => array.values.iter().map(|x| x.to_string()).collect::<Vec<String>>(), Some(buckets) => buckets .iter() .map(|bucket| { format!( "[{},{})={}", bucket.floor.format(), bucket.upper.format(), bucket.count.format() ) }) .collect::<Vec<String>>(), }; format!("{}{} = [{}]", value_indent, name, content.join(", ")) } } impl NumberFormat for i64 { fn format(&self) -> String { match *self { std::i64::MAX => "<max>".to_string(), std::i64::MIN => "<min>".to_string(), x => format!("{}", x), } } } impl NumberFormat for u64 { fn format(&self) -> String { match *self { std::u64::MAX => "<max>".to_string(), x => format!("{}", x), } } } impl NumberFormat for f64 { fn format(&self) -> String { if *self == std::f64::MAX || *self == std::f64::INFINITY { "inf".to_string() } else if *self == std::f64::MIN || *self == std::f64::NEG_INFINITY { "-inf".to_string() } else { format!("{}", self) } } }
use super::v2; use std::collections::BTreeMap; impl From<v2::DefaultPathItemRaw> for openapiv3::PathItem { fn from(v2: v2::DefaultPathItemRaw) -> Self { let methods = v2 .methods .iter() .map(|(k, v)| (*k, v.clone().into())) .collect::<BTreeMap<v2::HttpMethod, openapiv3::Operation>>(); openapiv3::PathItem { get: methods.get(&v2::HttpMethod::Get).cloned(), put: methods.get(&v2::HttpMethod::Put).cloned(), post: methods.get(&v2::HttpMethod::Post).cloned(), delete: methods.get(&v2::HttpMethod::Delete).cloned(), options: methods.get(&v2::HttpMethod::Options).cloned(), head: methods.get(&v2::HttpMethod::Head).cloned(), patch: methods.get(&v2::HttpMethod::Patch).cloned(), trace: None, servers: vec![], parameters: { openapiv3::Operation::from(v2::DefaultOperationRaw { parameters: v2.parameters, ..Default::default() }) .parameters }, extensions: indexmap::IndexMap::new(), description: None, summary: None, } } }
#[macro_use] extern crate criterion; extern crate rand; extern crate xoroshiro; use criterion::{Criterion, Fun}; use rand::{Rng, SeedableRng, XorShiftRng}; use xoroshiro::Xoroshiro128Rng; fn bench_prng(c: &mut Criterion) { let xorshift_u32 = Fun::new("XorShift", |b, _| { let mut rng = XorShiftRng::from_seed([100, 200, 300, 400]); return b.iter(|| rng.next_u32()); }); let xoroshiro128_u32 = Fun::new("Xoroshiro128", |b, _| { let mut rng = Xoroshiro128Rng::from_seed([100, 200]); return b.iter(|| rng.next_u32()); }); c.bench_functions("next_u32", vec![xorshift_u32, xoroshiro128_u32], 0); let xorshift_u64 = Fun::new("XorShift", |b, _| { let mut rng = XorShiftRng::from_seed([100, 200, 300, 400]); return b.iter(|| rng.next_u64()); }); let xoroshiro128_u64 = Fun::new("Xoroshiro128", |b, _| { let mut rng = Xoroshiro128Rng::from_seed([100, 200]); return b.iter(|| rng.next_u64()); }); c.bench_functions("next_u64", vec![xorshift_u64, xoroshiro128_u64], 0); } criterion_group!(benches, bench_prng); criterion_main!(benches);
use crate::postgres::types::try_resolve_type_name; use std::fmt::{self, Display}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct TypeId(pub(crate) u32); // DEVELOPER PRO TIP: find builtin type OIDs easily by grepping this file // https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat // // If you have Postgres running locally you can also try // SELECT oid, typarray FROM pg_type where typname = '<type name>' #[allow(dead_code)] impl TypeId { // Scalar pub(crate) const BOOL: TypeId = TypeId(16); pub(crate) const CHAR: TypeId = TypeId(18); pub(crate) const INT2: TypeId = TypeId(21); pub(crate) const INT4: TypeId = TypeId(23); pub(crate) const INT8: TypeId = TypeId(20); pub(crate) const OID: TypeId = TypeId(26); pub(crate) const FLOAT4: TypeId = TypeId(700); pub(crate) const FLOAT8: TypeId = TypeId(701); pub(crate) const NUMERIC: TypeId = TypeId(1700); pub(crate) const TEXT: TypeId = TypeId(25); pub(crate) const VARCHAR: TypeId = TypeId(1043); pub(crate) const BPCHAR: TypeId = TypeId(1042); pub(crate) const NAME: TypeId = TypeId(19); pub(crate) const UNKNOWN: TypeId = TypeId(705); pub(crate) const DATE: TypeId = TypeId(1082); pub(crate) const TIME: TypeId = TypeId(1083); pub(crate) const TIMESTAMP: TypeId = TypeId(1114); pub(crate) const TIMESTAMPTZ: TypeId = TypeId(1184); pub(crate) const BYTEA: TypeId = TypeId(17); pub(crate) const UUID: TypeId = TypeId(2950); pub(crate) const CIDR: TypeId = TypeId(650); pub(crate) const INET: TypeId = TypeId(869); // Arrays pub(crate) const ARRAY_BOOL: TypeId = TypeId(1000); pub(crate) const ARRAY_CHAR: TypeId = TypeId(1002); pub(crate) const ARRAY_INT2: TypeId = TypeId(1005); pub(crate) const ARRAY_INT4: TypeId = TypeId(1007); pub(crate) const ARRAY_INT8: TypeId = TypeId(1016); pub(crate) const ARRAY_OID: TypeId = TypeId(1028); pub(crate) const ARRAY_FLOAT4: TypeId = TypeId(1021); pub(crate) const ARRAY_FLOAT8: TypeId = TypeId(1022); pub(crate) const ARRAY_TEXT: TypeId = TypeId(1009); pub(crate) const ARRAY_VARCHAR: TypeId = TypeId(1015); pub(crate) const ARRAY_BPCHAR: TypeId = TypeId(1014); pub(crate) const ARRAY_NAME: TypeId = TypeId(1003); pub(crate) const ARRAY_NUMERIC: TypeId = TypeId(1231); pub(crate) const ARRAY_DATE: TypeId = TypeId(1182); pub(crate) const ARRAY_TIME: TypeId = TypeId(1183); pub(crate) const ARRAY_TIMESTAMP: TypeId = TypeId(1115); pub(crate) const ARRAY_TIMESTAMPTZ: TypeId = TypeId(1185); pub(crate) const ARRAY_BYTEA: TypeId = TypeId(1001); pub(crate) const ARRAY_UUID: TypeId = TypeId(2951); pub(crate) const ARRAY_CIDR: TypeId = TypeId(651); pub(crate) const ARRAY_INET: TypeId = TypeId(1041); // JSON pub(crate) const JSON: TypeId = TypeId(114); pub(crate) const JSONB: TypeId = TypeId(3802); // Records pub(crate) const RECORD: TypeId = TypeId(2249); pub(crate) const ARRAY_RECORD: TypeId = TypeId(2287); } impl Display for TypeId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if let Some(name) = try_resolve_type_name(self.0) { f.write_str(name) } else { write!(f, "<{}>", self.0) } } }
//! Implement Device use rcore_fs::dev::*; use spin::RwLock; /// memory buffer for device pub struct MemBuf(RwLock<&'static mut [u8]>); impl MemBuf { /// create a MemBuf struct pub fn new(buf: &'static mut [u8]) -> Self { MemBuf(RwLock::new(buf)) } } impl Device for MemBuf { fn read_at(&self, offset: usize, buf: &mut [u8]) -> Result<usize> { let slice = self.0.read(); let len = buf.len().min(slice.len() - offset); buf[..len].copy_from_slice(&slice[offset..offset + len]); Ok(len) } fn write_at(&self, offset: usize, buf: &[u8]) -> Result<usize> { let mut slice = self.0.write(); let len = buf.len().min(slice.len() - offset); slice[offset..offset + len].copy_from_slice(&buf[..len]); Ok(len) } fn sync(&self) -> Result<()> { Ok(()) } }
use parking_lot::Mutex; use ctxt::VM; use driver::cmd::Args; use gc::marking; use gc::root::{get_rootset, Slot}; use gc::space::Space; use gc::tlab; use gc::{formatted_size, Address, CollectionStats, Collector, GcReason, Region}; use os; use safepoint; use timer::Timer; pub struct SweepCollector { heap: Region, alloc: Mutex<SweepAllocator>, stats: Mutex<CollectionStats>, } impl SweepCollector { pub fn new(args: &Args) -> SweepCollector { let heap_size = args.max_heap_size(); let ptr = os::mmap(heap_size, os::Writable); if ptr.is_null() { panic!("could not allocate heap of size {} bytes", heap_size); } let heap_start = Address::from_ptr(ptr); let heap_end = heap_start.offset(heap_size); let heap = Region::new(heap_start, heap_end); if args.flag_gc_verbose { println!("GC: {} {}", heap, formatted_size(heap_size)); } let alloc = SweepAllocator { top: heap_start, limit: heap_end, }; SweepCollector { heap: heap, alloc: Mutex::new(alloc), stats: Mutex::new(CollectionStats::new()), } } } impl Collector for SweepCollector { fn supports_tlab(&self) -> bool { true } fn alloc_tlab_area(&self, _vm: &VM, _size: usize) -> Option<Region> { unimplemented!() } fn alloc(&self, _vm: &VM, _size: usize, _array_ref: bool) -> Address { unimplemented!() } fn collect(&self, vm: &VM, reason: GcReason) { let mut timer = Timer::new(vm.args.flag_gc_stats); safepoint::stop_the_world(vm, |threads| { vm.perf_counters.stop(); tlab::make_iterable_all(vm, threads); let rootset = get_rootset(vm, threads); self.mark_sweep(vm, &rootset, reason); vm.perf_counters.start(); }); if vm.args.flag_gc_stats { let duration = timer.stop(); let mut stats = self.stats.lock(); stats.add(duration); } } fn minor_collect(&self, vm: &VM, reason: GcReason) { self.collect(vm, reason); } fn dump_summary(&self, runtime: f32) { let stats = self.stats.lock(); let (mutator, gc) = stats.percentage(runtime); println!("GC stats: total={:.1}", runtime); println!("GC stats: mutator={:.1}", stats.mutator(runtime)); println!("GC stats: collection={:.1}", stats.pause()); println!(""); println!("GC stats: collection-count={}", stats.collections()); println!("GC stats: collection-pauses={}", stats.pauses()); println!( "GC summary: {:.1}ms collection ({}), {:.1}ms mutator, {:.1}ms total ({}% mutator, {}% GC)", stats.pause(), stats.collections(), stats.mutator(runtime), runtime, mutator, gc, ); } } impl Drop for SweepCollector { fn drop(&mut self) { os::munmap(self.heap.start.to_ptr(), self.heap.size()); } } impl SweepCollector { fn mark_sweep(&self, vm: &VM, rootset: &[Slot], reason: GcReason) { let start = self.heap.start; let top = self.alloc.lock().top; let mut collector = MarkSweep { vm: vm, heap: Region::new(start, top), perm_space: &vm.gc.perm_space, rootset: rootset, reason: reason, }; collector.collect(); } } struct MarkSweep<'a, 'ast: 'a> { vm: &'a VM<'ast>, heap: Region, perm_space: &'a Space, rootset: &'a [Slot], reason: GcReason, } impl<'a, 'ast> MarkSweep<'a, 'ast> { fn collect(&mut self) { self.mark(); self.sweep(); } fn mark(&mut self) { marking::start(self.rootset, self.heap, self.perm_space.total()); } fn sweep(&mut self) { let start = self.heap.start; let end = self.heap.end; let mut scan = start; while scan < end { let object = scan.to_mut_obj(); if object.header().vtblptr().is_null() { scan = scan.add_ptr(1); continue; } let object_size = object.size(); if object.header().is_marked_non_atomic() { object.header_mut().unmark_non_atomic(); } else { unimplemented!(); } scan = scan.offset(object_size); } } } struct SweepAllocator { top: Address, limit: Address, }
#![feature(macro_rules)] extern crate openal; use std::io::File; use runge_kutta::step_rk4; use units::{ Mass, Length, Velocity, Stiffness, Damping }; use instrument::{Particle, Instrument, InstrumentState}; use std::i16; use openal::{al, alc}; use std::io::timer::sleep; use std::time::duration::Duration; mod runge_kutta; mod units; mod instrument; #[allow(dead_code)] fn make_simple_instrument(mut instrument: Instrument) -> (Instrument, Particle) { let p_0 = instrument.add_particle(Mass(1.0), Length(0.0)); let p_1 = instrument.add_particle(Mass(1.0e-2), Length(0.0)); instrument.add_spring(p_0, p_1, Length(1.0), Stiffness(1.0e3), Damping(1e-1), false); instrument.earth(p_0); (instrument, p_1) } fn make_string() -> (Instrument, Particle, Particle, Particle) { let hammer_mass = Mass(0.05); let hammer_stiffness = Stiffness(1e3); let string_mass = Mass(1e-2); let string_stiffness = Stiffness(3e5); let string_damping = Damping(0.5); let air_damping = Damping(0.3); let mut instrument = Instrument::new(); let p_earth = instrument.add_particle(string_mass, Length(0.0)); let p_target = instrument.add_particle(string_mass, Length(0.0)); let p_pickup = instrument.add_particle(string_mass, Length(0.0)); let p_hammer = instrument.add_particle(hammer_mass, Length(0.0)); instrument.earth(p_earth); instrument.add_chain(p_earth, p_target, 15, string_mass, string_stiffness, string_damping); instrument.add_chain(p_target, p_pickup, 15, string_mass, string_stiffness, string_damping); instrument.add_chain(p_pickup, p_earth, 15, string_mass, string_stiffness, string_damping); instrument.add_spring(p_hammer, p_target, Length(0.0), hammer_stiffness, Damping(0.0), true); instrument.add_spring(p_pickup, p_earth, Length(0.0), Stiffness(0.0), air_damping, false); (instrument, p_hammer, p_target, p_pickup) } fn slice_as_bytes<'a, T>(slice: &'a [T]) -> &'a [u8] { unsafe { std::mem::transmute(std::raw::Slice { data: slice.as_ptr(), len: slice.len() * std::mem::size_of::<T>() }) } } fn main() { let hammer_velocity = Velocity(1e1); let (instrument, p_hammer, p_target, p_pickup) = make_string(); let mut state = InstrumentState::new(&instrument); state.trigger_hammer(p_hammer, p_target, hammer_velocity); let sample_freq = 44100.0; let duration = 10.0; let num_samples = (sample_freq * duration) as uint; let dt = 1.0 / sample_freq; let mut peak = 0.0f64; println!("Generating"); let amplitudes = Vec::from_fn(num_samples, |i| { let t = (i as f64) * dt; state = step_rk4(t, dt, &state); let Velocity(amplitude) = state.particle_state(p_pickup).velocity; if amplitude > peak { peak = amplitude; } if -amplitude > peak { peak = -amplitude; } amplitude }); if peak == 0.0 { // avoid div-by-zero for all-zero waveform peak = 1.0; } let samples: Vec<i16> = amplitudes.iter().map(|amplitude| { (*amplitude / peak * (i16::MAX - 1) as f64) as i16 }).collect(); let device = alc::Device::open(None).expect("Could not open device"); let ctx = device.create_context(&[]).expect("Could not create context"); ctx.make_current(); let buffer = al::Buffer::gen(); let source = al::Source::gen(); println!("Writing"); { let mut f = File::create(&Path::new("sound.raw")); f.write(slice_as_bytes(samples.as_slice())); } unsafe { buffer.buffer_data(al::FormatMono16, samples.as_slice(), sample_freq as al::ALsizei) }; println!("Playing"); source.queue_buffer(&buffer); source.play(); while source.is_playing() { sleep(Duration::milliseconds((duration * 100.0) as i64)); } ctx.destroy(); device.close().ok().expect("Unable to close device"); }
//! # Struct to Json String and reverse. //! This sample aims to show the usage of serde for the following scenarios. //! //! * Serialize struct to json string. //! * Deserialize json string to struct. extern crate serde_json; /// Shows the basic usage of the scenario. pub fn run() { let child1 = Sample { name: "John".to_string(), age: 15, children: vec![], }; let child2 = Sample { name: "Jane".to_string(), age: 10, children: vec![], }; let parent = Sample { name: "Joe".to_string(), age: 40, children: vec![child1, child2], }; println!("\n* struct_json"); // First serialize struct to json string. let serialized = serde_json::to_string(&parent).unwrap(); println!("\tSerialized : {}", &serialized); // Than deserialize json string to struct. let deserialized: Sample = serde_json::from_str(&serialized).unwrap(); println!("\tDeserialized: {:?}", &deserialized); } //These are for auto ser,de founction generation. #[derive(Serialize, Deserialize)] #[derive(Debug)] /// A sample struct. struct Sample { name: String, age: u8, children: Vec<Sample>, }
// Hello World program in the rust programming language. // fn main() - the function that will be automatically executed when the file is directly executed fn main() { // println is a built-in macro (see docs on macro at the links up top) that recieves a string and outputs it to the display println!("Hello, World!"); } // for more info, check this : https://www.rust-lang.org/ // for the documentation: https://doc.rust-lang.org/book/title-page.html // for an explanation on macros : https://doc.rust-lang.org/book/ch19-06-macros.html // Output : // Hello, World!
pub mod about; pub mod filter; pub mod menu; pub mod model; pub mod task_row;
use utilities::prelude::*; use vulkan_rs::prelude::*; use std::sync::Arc; use crate::prelude::*; pub trait TScene { fn update(&self) -> VerboseResult<()>; fn process( &self, command_buffer: &Arc<CommandBuffer>, indices: &TargetMode<usize>, ) -> VerboseResult<()>; fn resize(&self) -> VerboseResult<()>; } pub trait PostProcess { /// higher priority means, it is executed earlier fn priority(&self) -> u32; fn process( &self, command_buffer: &Arc<CommandBuffer>, indices: &TargetMode<usize>, ) -> VerboseResult<()>; fn resize(&self, width: u32, height: u32) -> VerboseResult<()>; } pub trait RenderCore: std::fmt::Debug { fn next_frame(&self) -> VerboseResult<bool>; fn format(&self) -> VkFormat; fn image_layout(&self) -> VkImageLayout { VK_IMAGE_LAYOUT_PRESENT_SRC_KHR } fn set_clear_color(&self, color: [f32; 4]) -> VerboseResult<()>; // scene handling fn add_scene(&self, scene: Arc<dyn TScene + Sync + Send>) -> VerboseResult<()>; fn remove_scene(&self, scene: &Arc<dyn TScene + Sync + Send>) -> VerboseResult<()>; fn clear_scenes(&self) -> VerboseResult<()>; // post process handling fn add_post_processing_routine( &self, post_process: Arc<dyn PostProcess + Sync + Send>, ) -> VerboseResult<()>; fn remove_post_processing_routine( &self, post_process: &Arc<dyn PostProcess + Sync + Send>, ) -> VerboseResult<()>; fn clear_post_processing_routines(&self) -> VerboseResult<()>; // getter fn image_count(&self) -> usize; fn images(&self) -> VerboseResult<TargetMode<Vec<Arc<Image>>>>; fn allocate_primary_buffer(&self) -> VerboseResult<Arc<CommandBuffer>>; fn allocate_secondary_buffer(&self) -> VerboseResult<Arc<CommandBuffer>>; fn width(&self) -> u32; fn height(&self) -> u32; fn transformations(&self) -> VerboseResult<Option<(VRTransformations, VRTransformations)>>; }
use std::io; use std::io::Read; fn main() { let mut input = String::new(); io::stdin().read_to_string(&mut input).unwrap(); let numbers: Vec<u64> = input.lines().map(|x| x.parse().unwrap()).collect(); const WINDOW: usize = 25; println!("{}", numbers.iter().enumerate().skip(WINDOW).find_map(|(n, &x)| { if numbers.iter().enumerate().skip(n - WINDOW).take(WINDOW).any(|(m, &y)| { numbers[m + 1..n].iter().any(|&z| y != z && y + z == x) }) { None } else { Some(x) } }).unwrap()); }
// 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. //! Implementation of fuchsia.net.icmp.EchoSocket. use failure::Fail; use futures::channel::mpsc; use futures::{select, StreamExt}; use log::{error, trace}; use std::collections::VecDeque; use std::fmt; use std::sync::{Arc, Mutex}; use fuchsia_async as fasync; use fuchsia_zircon as zx; use fidl_fuchsia_net_icmp::{ EchoPacket, EchoSocketRequest, EchoSocketRequestStream, EchoSocketWatchResponder, EchoSocketWatchResult, }; use net_types::ip::IpVersion; use netstack3_core::icmp as core_icmp; use netstack3_core::icmp::IcmpConnId; use netstack3_core::{BufferDispatcher, Context}; use packet_new::{Buf, BufferMut}; use crate::eventloop::icmp::RX_BUFFER_SIZE; use crate::eventloop::{Event, EventLoop}; /// A request event for an [`EchoSocketWorker`]. #[derive(Debug)] pub struct Request { worker: Arc<Mutex<EchoSocketWorkerInner<EchoSocketWatchResponder, IcmpConnId>>>, request: EchoSocketRequest, } impl Request { /// Handles this [`EchoSocketRequest`] with the provided `EventLoop` context. pub fn handle_request(self, event_loop: &mut EventLoop) { self.worker.lock().unwrap().handle_request(event_loop, self.request); } } /// Worker for handling requests from a [`fidl_fuchsia_net_icmp::EchoSocketRequestStream`]. pub struct EchoSocketWorker { stream: EchoSocketRequestStream, reply_rx: mpsc::Receiver<EchoPacket>, inner: Arc<Mutex<EchoSocketWorkerInner<EchoSocketWatchResponder, IcmpConnId>>>, } impl EchoSocketWorker { /// Create a new EchoSocketWorker, a wrapper around a background worker that handles requests /// from a [`fidl_fuchsia_net_icmp::EchoSocketRequestStream`]. pub fn new( stream: EchoSocketRequestStream, reply_rx: mpsc::Receiver<EchoPacket>, net_proto: IpVersion, conn: IcmpConnId, icmp_id: u16, ) -> EchoSocketWorker { EchoSocketWorker { stream, reply_rx, inner: Arc::new(Mutex::new(EchoSocketWorkerInner::new( net_proto, conn, icmp_id, RX_BUFFER_SIZE, ))), } } /// Spawn a background worker to handle requests from a /// [`fidl_fuchsia_net_icmp::EchoSocketRequestStream`]. pub fn spawn(mut self, sender: mpsc::UnboundedSender<Event>) { fasync::spawn_local(async move { loop { select! { evt = self.stream.next() => { if let Some(Ok(e)) = evt { let evt = Event::FidlEchoSocketEvent(Request { worker: Arc::clone(&self.inner), request: e, }); if let Err(e) = sender.unbounded_send(evt) { error!("Failed to send echo socket event: {:?}", e); } } else { // Client has closed the request stream. return; } }, reply = self.reply_rx.next() => { if let Some(r) = reply { let mut worker = match self.inner.lock() { Ok(w) => w, Err(e) => { error!("Mutex has been poisoned: {:?}", e); return; } }; if let Err(e) = worker.handle_reply(r) { error!("Failed to handle reply: {:?}", e); } } else { // Netstack3 has closed the EchoPacket channel. return; } }, complete => return, }; } }); } } /// Error type for working with ICMP echo sockets. #[derive(Fail, Debug)] pub enum ResponderError { #[fail(display = "FIDL failure: {}", _0)] Fidl(fidl::Error), #[fail(display = "Reached reply buffer capacity")] ReachedCapacity, } /// `Responder` represents a request to watch for a result. The request is completed once /// `respond` is called with an `EchoSocketWatchResult`, consuming the `Responder`. This /// abstraction allows for mocking. pub trait Responder { /// Send a response. fn respond(self, result: &mut EchoSocketWatchResult) -> Result<(), ResponderError>; } impl Responder for EchoSocketWatchResponder { fn respond(self, result: &mut EchoSocketWatchResult) -> Result<(), ResponderError> { self.send(result).map_err(|e| ResponderError::Fidl(e)) } } /// Implementation for an `EchoSocket`. #[derive(Debug)] pub struct EchoSocketWorkerInner<R: Responder, C> { net_proto: IpVersion, conn: C, icmp_id: u16, results: VecDeque<EchoSocketWatchResult>, responders: VecDeque<R>, capacity: usize, } impl<R: Responder, C: fmt::Debug> EchoSocketWorkerInner<R, C> { fn new(net_proto: IpVersion, conn: C, icmp_id: u16, capacity: usize) -> Self { EchoSocketWorkerInner { net_proto, conn, icmp_id, capacity, results: VecDeque::with_capacity(capacity + 1), // one additional element for IO_OVERRUN responders: VecDeque::with_capacity(capacity + 1), } } fn handle_reply(&mut self, reply: EchoPacket) -> Result<(), ResponderError> { trace!("Handling an ICMP Echo reply: {:?}", reply); if self.results.len() > self.capacity { return Err(ResponderError::ReachedCapacity); } if self.results.len() == self.capacity { self.results.push_back(Err(zx::Status::into_raw(zx::Status::IO_OVERRUN))); return self.respond().and(Err(ResponderError::ReachedCapacity)); } self.results.push_back(Ok(reply)); self.respond() } fn respond(&mut self) -> Result<(), ResponderError> { if !self.results.is_empty() && !self.responders.is_empty() { let mut result = self.results.pop_front().unwrap(); // Just checked if empty let responder = self.responders.pop_front().unwrap(); responder.respond(&mut result)?; } Ok(()) } fn watch(&mut self, responder: R) -> Result<(), ResponderError> { trace!("Watching for an ICMP Echo reply for {:?} on {:?}", self.conn, self.net_proto); self.responders.push_back(responder); self.respond() } } impl EchoSocketWorkerInner<EchoSocketWatchResponder, IcmpConnId> { /// Handle a `fidl_fuchsia_net_icmp::EchoSocketRequest`, which is used for sending ICMP echo /// requests and receiving ICMP echo replies. fn handle_request(&mut self, event_loop: &mut EventLoop, req: EchoSocketRequest) { match req { EchoSocketRequest::SendRequest { mut request, .. } => { let len = request.payload.len(); self.send_request( &mut event_loop.ctx, request.sequence_num, Buf::new(&mut request.payload.as_mut_slice()[..len], ..), ); } EchoSocketRequest::Watch { responder } => { match self.watch(responder) { Ok(_) => {} Err(e) => { error!("Failed to watch an ICMP echo socket: {:?}", e); } }; } } } fn send_request<B: BufferMut, D: BufferDispatcher<B>>( &self, ctx: &mut Context<D>, seq_num: u16, payload: B, ) { trace!("Sending ICMP Echo request for {:?} w/ sequence number {}", self.conn, seq_num); match self.net_proto { IpVersion::V4 => core_icmp::send_icmpv4_echo_request(ctx, self.conn, seq_num, payload), IpVersion::V6 => core_icmp::send_icmpv6_echo_request(ctx, self.conn, seq_num, payload), }; // TODO(fxb/37143): Report ICMP errors to responders, once implemented in the core, by // pushing a zx::Status to `self.results`. } } #[cfg(test)] mod test { use fidl_fuchsia_net_icmp::{EchoPacket, EchoSocketWatchResult}; use fuchsia_zircon as zx; use net_types::ip::IpVersion; use super::{EchoSocketWorkerInner, Responder, ResponderError}; struct TestResponder { expected: Result<EchoPacket, zx::Status>, } impl Responder for TestResponder { fn respond(self, result: &mut EchoSocketWatchResult) -> Result<(), ResponderError> { assert_eq!(self.expected, result.clone().map_err(|e| zx::Status::from_raw(e))); Ok(()) } } fn create_worker_with_capacity(capacity: usize) -> EchoSocketWorkerInner<TestResponder, u8> { EchoSocketWorkerInner::new(IpVersion::V4, 1, 1, capacity) } #[test] fn test_icmp_echo_socket_worker_no_responder() { let mut worker = create_worker_with_capacity(1); let payload = vec![1, 2, 3, 4, 5]; let packet = EchoPacket { sequence_num: 1, payload }; assert!(worker.handle_reply(packet).is_ok()); } #[test] fn test_icmp_echo_socket_worker_no_reply() { let mut worker = create_worker_with_capacity(1); let payload = vec![1, 2, 3, 4, 5]; let packet = EchoPacket { sequence_num: 1, payload }; assert!(worker.watch(TestResponder { expected: Ok(packet) }).is_ok()); } #[test] fn test_icmp_echo_socket_worker_reply_then_watch() { let mut worker = create_worker_with_capacity(1); let payload = vec![1, 2, 3, 4, 5]; let packet = EchoPacket { sequence_num: 1, payload }; worker.handle_reply(packet.clone()).unwrap(); worker.watch(TestResponder { expected: Ok(packet) }).unwrap(); } #[test] fn test_icmp_echo_socket_worker_watch_then_reply() { let mut worker = create_worker_with_capacity(1); let payload = vec![1, 2, 3, 4, 5]; let packet = EchoPacket { sequence_num: 1, payload }; worker.watch(TestResponder { expected: Ok(packet.clone()) }).unwrap(); worker.handle_reply(packet).unwrap(); } #[test] fn test_icmp_echo_socket_worker_reply_in_order() { let mut worker = create_worker_with_capacity(2); let first_packet = EchoPacket { sequence_num: 1, payload: vec![0, 1, 2, 3, 4] }; let second_packet = EchoPacket { sequence_num: 2, payload: vec![5, 6, 7, 8, 9] }; worker.handle_reply(first_packet.clone()).unwrap(); worker.handle_reply(second_packet.clone()).unwrap(); worker.watch(TestResponder { expected: Ok(first_packet) }).unwrap(); worker.watch(TestResponder { expected: Ok(second_packet) }).unwrap(); } #[test] fn test_icmp_echo_socket_worker_watch_in_order() { let mut worker = create_worker_with_capacity(2); let first_packet = EchoPacket { sequence_num: 1, payload: vec![0, 1, 2, 3, 4] }; let second_packet = EchoPacket { sequence_num: 2, payload: vec![5, 6, 7, 8, 9] }; worker.watch(TestResponder { expected: Ok(first_packet.clone()) }).unwrap(); worker.watch(TestResponder { expected: Ok(second_packet.clone()) }).unwrap(); worker.handle_reply(first_packet).unwrap(); worker.handle_reply(second_packet).unwrap(); } #[test] fn test_icmp_echo_socket_worker_reply_over_capacity() { let mut worker = create_worker_with_capacity(1); let first_packet = EchoPacket { sequence_num: 1, payload: vec![0, 1, 2, 3, 4] }; let second_packet = EchoPacket { sequence_num: 2, payload: vec![5, 6, 7, 8, 9] }; worker.handle_reply(first_packet.clone()).unwrap(); worker.handle_reply(second_packet.clone()).unwrap_err(); worker.watch(TestResponder { expected: Ok(first_packet) }).unwrap(); worker.watch(TestResponder { expected: Err(zx::Status::IO_OVERRUN) }).unwrap(); } #[test] fn test_icmp_echo_socket_worker_reply_over_capacity_recover() { let mut worker = create_worker_with_capacity(1); let first_packet = EchoPacket { sequence_num: 1, payload: vec![0, 1, 2, 3, 4] }; let second_packet = EchoPacket { sequence_num: 2, payload: vec![5, 6, 7, 8, 9] }; let third_packet = EchoPacket { sequence_num: 3, payload: vec![2, 4, 6, 8, 0] }; worker.handle_reply(first_packet.clone()).unwrap(); worker.handle_reply(second_packet).unwrap_err(); // second_packet should be dropped worker.watch(TestResponder { expected: Ok(first_packet) }).unwrap(); worker.watch(TestResponder { expected: Err(zx::Status::IO_OVERRUN) }).unwrap(); worker.handle_reply(third_packet.clone()).unwrap(); worker.watch(TestResponder { expected: Ok(third_packet) }).unwrap(); } #[test] fn test_icmp_echo_socket_worker_reply_over_capacity_twice_recover() { let mut worker = create_worker_with_capacity(1); let first_packet = EchoPacket { sequence_num: 1, payload: vec![0, 1, 2, 3, 4] }; let second_packet = EchoPacket { sequence_num: 2, payload: vec![5, 6, 7, 8, 9] }; let third_packet = EchoPacket { sequence_num: 3, payload: vec![2, 4, 6, 8, 0] }; let fourth_packet = EchoPacket { sequence_num: 4, payload: vec![1, 3, 5, 7, 9] }; worker.handle_reply(first_packet.clone()).unwrap(); worker.handle_reply(second_packet).unwrap_err(); // second_packet should be dropped worker.handle_reply(third_packet).unwrap_err(); // third_packet should be dropped worker.watch(TestResponder { expected: Ok(first_packet) }).unwrap(); worker.watch(TestResponder { expected: Err(zx::Status::IO_OVERRUN) }).unwrap(); worker.handle_reply(fourth_packet.clone()).unwrap(); worker.watch(TestResponder { expected: Ok(fourth_packet) }).unwrap(); } #[test] fn test_icmp_echo_socket_worker_watch_over_capacity_recover() { let mut worker = create_worker_with_capacity(1); let first_packet = EchoPacket { sequence_num: 1, payload: vec![0, 1, 2, 3, 4] }; let second_packet = EchoPacket { sequence_num: 2, payload: vec![5, 6, 7, 8, 9] }; let third_packet = EchoPacket { sequence_num: 3, payload: vec![2, 4, 6, 8, 0] }; let fourth_packet = EchoPacket { sequence_num: 4, payload: vec![1, 3, 5, 7, 9] }; worker.watch(TestResponder { expected: Ok(first_packet.clone()) }).unwrap(); worker.watch(TestResponder { expected: Ok(second_packet.clone()) }).unwrap(); worker.handle_reply(first_packet).unwrap(); worker.handle_reply(second_packet).unwrap(); worker.handle_reply(third_packet.clone()).unwrap(); worker.handle_reply(fourth_packet).unwrap_err(); // fourth_packet should be dropped worker.watch(TestResponder { expected: Ok(third_packet) }).unwrap(); worker.watch(TestResponder { expected: Err(zx::Status::IO_OVERRUN) }).unwrap(); } #[test] fn test_icmp_echo_socket_worker_watch_over_capacity_twice_recover() { let mut worker = create_worker_with_capacity(1); let first_packet = EchoPacket { sequence_num: 1, payload: vec![0, 1, 2, 3, 4] }; let second_packet = EchoPacket { sequence_num: 2, payload: vec![5, 6, 7, 8, 9] }; let third_packet = EchoPacket { sequence_num: 3, payload: vec![2, 4, 6, 8, 0] }; let fourth_packet = EchoPacket { sequence_num: 4, payload: vec![1, 3, 5, 7, 9] }; worker.watch(TestResponder { expected: Ok(first_packet.clone()) }).unwrap(); worker.handle_reply(first_packet).unwrap(); worker.handle_reply(second_packet.clone()).unwrap(); worker.handle_reply(third_packet.clone()).unwrap_err(); // third_packet should be dropped worker.watch(TestResponder { expected: Ok(second_packet) }).unwrap(); worker.watch(TestResponder { expected: Err(zx::Status::IO_OVERRUN) }).unwrap(); worker.watch(TestResponder { expected: Ok(fourth_packet.clone()) }).unwrap(); worker.handle_reply(fourth_packet.clone()).unwrap(); } }
use tddbc_rust_practice::range::closed_range::ClosedRange; use tddbc_rust_practice::range::open_range::OpenRange; use tddbc_rust_practice::range::MultiRange; use tddbc_rust_practice::range::SelfRange; #[test] fn new_success() { // 通常 let lower = 1; let upper = 5; let builder = ClosedRange::new(lower, upper); let constructor = ClosedRange { lower: lower, upper: upper, }; assert_eq!(&builder.lower, &constructor.lower); assert_eq!(&builder.upper, &constructor.upper); } #[test] fn new_same_numbers() { // 閉区間は両端を含むので、下限と上限は同じ値を入力しても問題ない let lower = 5; let upper = 5; let builder = ClosedRange::new(lower, upper); let constructor = ClosedRange { lower: lower, upper: upper, }; assert_eq!(&builder.lower, &constructor.lower); assert_eq!(&builder.upper, &constructor.upper); } #[test] #[should_panic(expected = "下限と上限の値が不正です")] fn new_error() { // 下限、上限の入力が不正な場合 let lower = 5; let upper = 1; ClosedRange::new(lower, upper); } #[test] fn parse() { let lower = 12; let upper = 56; let base = ClosedRange::new(lower, upper); let parsed = ClosedRange::parse("[12,56]".to_owned()); assert_eq!(base.equals(&parsed), true) } #[test] #[should_panic] fn parse_error() { ClosedRange::parse("(1,5]".to_owned()); } #[test] #[should_panic(expected = "下限と上限の値が不正です")] fn parse_error_number() { ClosedRange::parse("[100,50]".to_owned()); } #[test] fn to_string() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); assert_eq!(closed_range.to_string(), "[1,5]".to_owned()) } #[test] fn contains() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // 含まれる assert_eq!(closed_range.contains(3), true); // 境界値 assert_eq!(closed_range.contains(1), true); assert_eq!(closed_range.contains(5), true); // 含まれない assert_eq!(closed_range.contains(-1), false); assert_eq!(closed_range.contains(100), false); } #[test] fn equals_same() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // 同じもの let closed_range_same = ClosedRange::new(1, 5); assert_eq!(closed_range.equals(&closed_range_same), true); } #[test] fn equals_different() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // 異なるもの let closed_range_different = ClosedRange::new(1, 10); assert_eq!(closed_range.equals(&closed_range_different), false); } #[test] fn is_connected_to() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // 接続 let connected = ClosedRange::new(2, 6); assert_eq!(closed_range.is_connected_to(&connected), true); // 接続していない let unconnected = ClosedRange::new(6, 10); assert_eq!(closed_range.is_connected_to(&unconnected), false); // 閉区間の両端は含まれる let upper_connected = ClosedRange::new(5, 10); assert_eq!(closed_range.is_connected_to(&upper_connected), true); let lower_connected = ClosedRange::new(-10, 1); assert_eq!(closed_range.is_connected_to(&lower_connected), true); // ベースを包含している let range_include_base = ClosedRange::new(-10, 10); assert_eq!(closed_range.is_connected_to(&range_include_base), true); // ベースが包含している let base_include_range = ClosedRange::new(2, 4); assert_eq!(closed_range.is_connected_to(&base_include_range), true); } #[test] fn contains_all() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // すべて含む let all_contain = vec![1, 2, 3, 4, 5]; assert_eq!(closed_range.contains_all(all_contain), true); // 含まない let not_all_contain = vec![0, 1, 2, 3, 4, 5]; assert_eq!(closed_range.contains_all(not_all_contain), false); } #[test] fn equals_with_open_range() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // 上端、下端に同じ整数が入ろうとも、必ずfalse let open_range = OpenRange::new(lower, upper); assert_eq!(closed_range.equals(&open_range), false); } #[test] fn is_connected_to_with_open_range() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // 接続 let connected = OpenRange::new(4, 8); assert_eq!(closed_range.is_connected_to(&connected), true); // 接続していない let unconnected = OpenRange::new(6, 10); assert_eq!(closed_range.is_connected_to(&unconnected), false); // 閉区間の両端は含まれ、閉区間の両端は含まれない let upper_connected = OpenRange::new(5, 10); assert_eq!(closed_range.is_connected_to(&upper_connected), false); let lower_connected = OpenRange::new(-10, 1); assert_eq!(closed_range.is_connected_to(&lower_connected), false); // ベースを包含している let range_include_base = OpenRange::new(-10, 10); assert_eq!(closed_range.is_connected_to(&range_include_base), true); // ベースが包含している let base_include_range = OpenRange::new(2, 4); assert_eq!(closed_range.is_connected_to(&base_include_range), true); } #[test] fn get_intersection_with_closed_range() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // a.ベースの区間と左側にずれて接続 let closed_range_a = ClosedRange::new(-2, 4); assert_eq!( closed_range.get_intersection(&closed_range_a), "[1,4]".to_owned() ); // b.ベースの区間と右側にずれて接続 let closed_range_b = ClosedRange::new(3, 10); assert_eq!( closed_range.get_intersection(&closed_range_b), "[3,5]".to_owned() ); // c.ベースの区間が対象区間を包含している let closed_range_c = ClosedRange::new(2, 4); assert_eq!( closed_range.get_intersection(&closed_range_c), "[2,4]".to_owned() ); // d.ベースの区間が対象区間によって包含されている let closed_range_d = ClosedRange::new(-2, 10); assert_eq!( closed_range.get_intersection(&closed_range_d), "[1,5]".to_owned() ); // e.同じlower,upper let closed_range_e = ClosedRange::new(1, 5); assert_eq!( closed_range.get_intersection(&closed_range_e), "[1,5]".to_owned() ); } #[test] #[should_panic(expected = "共通集合はありません")] fn get_intersection_with_closed_range_error() { // 下限、上限の入力が不正な場合 let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); let closed_range_error = ClosedRange::new(-5, -1); closed_range.get_intersection(&closed_range_error); } #[test] fn get_intersection_with_open_range() { let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); // a.ベースの区間と左側にずれて接続 let open_range_a = OpenRange::new(-2, 4); assert_eq!( closed_range.get_intersection(&open_range_a), "[1,4)".to_owned() ); // b.ベースの区間と右側にずれて接続 let open_range_b = OpenRange::new(3, 10); assert_eq!( closed_range.get_intersection(&open_range_b), "(3,5]".to_owned() ); // c.ベースの区間が対象区間を包含している let open_range_c = OpenRange::new(2, 4); assert_eq!( closed_range.get_intersection(&open_range_c), "(2,4)".to_owned() ); // d.ベースの区間が対象区間によって包含されている let open_range_d = OpenRange::new(-2, 10); assert_eq!( closed_range.get_intersection(&open_range_d), "[1,5]".to_owned() ); // e.同じlower,upper let open_range_e = OpenRange::new(1, 5); assert_eq!( closed_range.get_intersection(&open_range_e), "(1,5)".to_owned() ); } #[test] #[should_panic(expected = "共通集合はありません")] fn get_intersection_with_open_range_error() { // 下限、上限の入力が不正な場合 let lower = 1; let upper = 5; let closed_range = ClosedRange::new(lower, upper); let open_range_error = OpenRange::new(-5, 1); closed_range.get_intersection(&open_range_error); }
fn main() { let a1 = [ 1i32, 2, 3 ]; let a2 = [ 1.0f64, 2.0f64, 3.1f64 ]; let a3 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]; let mut index = 0; println!("a1 has {} things!", a1.len()); for item in a1.iter() { println!("a1[{}]={}", index, item); index = index + 1; } for item in a2.iter() { println!("a2[{}]={}", index, item); index = index + 1; } let sliced_a = &a3[3..6]; for item in sliced_a.iter() { println!("sliced_a[{}]={}", index, item); index = index + 1; } }
pub mod point2d; pub mod point3d;
#[path = "with_link_and_monitor_in_options_list/with_arity_zero.rs"] mod with_arity_zero; test_stdout!( without_arity_zero_returns_pid_to_parent_and_child_process_exits_badarity_and_exits_parent, "{parent, badarity}\n" );
// Copyright 2020-2021, The Tremor Team // // 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. // This file is OS dependant so testing the errors is near impossible to re-create on a reproducible // basis #![cfg(not(tarpaulin_include))] use async_std::{fs::File, path::Path, path::PathBuf}; use crate::errors::Error; /// A wrapper around `File::open` that will give a better error (including the filename) /// /// # Errors /// * if the file couldn't be opened pub async fn open<S>(path: &S) -> Result<File, Error> where S: AsRef<Path> + ?Sized, { File::open(path).await.map_err(|e| { let p: &Path = path.as_ref(); Error::FileOpen(e, p.to_string_lossy().to_string()) }) } /// A wrapper around `File::create` that will give a better error (including the filename) /// /// # Errors /// * if the file couldn't be created pub async fn create<S>(path: &S) -> Result<File, Error> where S: AsRef<Path> + ?Sized, { File::create(path).await.map_err(|e| { let p: &Path = path.as_ref(); Error::FileCreate(e, p.to_string_lossy().to_string()) }) } /// A wrapper around `fs::canonicalize` that will give a better error (including the filename) /// /// # Errors /// * if the path does not exist pub async fn canonicalize<S>(path: &S) -> Result<PathBuf, Error> where S: AsRef<Path> + ?Sized, { async_std::fs::canonicalize(path).await.map_err(|e| { let p: &Path = path.as_ref(); Error::FileCanonicalize(e, p.to_string_lossy().to_string()) }) } pub use crate::file::extension;
//主函数 fn main() { //println!("Hello, world!"); // 定义病初始化一个变量var1 //let var1 = 1; //打印格式化文本并在结尾输出换行 //println!("{}",var1); //对不可变变量重新赋值--->会报错 //var1 = 2; //println!("{}",var1); //定义可变变量 mut var1 //let mut var1 = 1; //println!("{}",var1);//输出1 //var1 = 2; //println!("{}",var1);//输出2 //定义整形静态变量,静态变量定义时必须同时初始化并制定类型 static VAR1:i32 = 0; //定义一个可变静态变量 static mut VAR2:i32 = 0; //在unsafe作用域中读写VAR2 unsafe { println!("{}",VAR2);//--->输出0 VAR2 = 2; println!("{}",VAR2);// --->输出2 } println!("{}",VAR1); //----->输出0 }
use byteorder::{BigEndian, ReadBytesExt}; use std::io::{Read, Seek, SeekFrom}; use std::mem::size_of; use std::string::{FromUtf8Error, FromUtf16Error}; use {Date, Error, Result, PlistEvent, u64_to_usize}; impl From<FromUtf8Error> for Error { fn from(_: FromUtf8Error) -> Error { Error::InvalidData } } impl From<FromUtf16Error> for Error { fn from(_: FromUtf16Error) -> Error { Error::InvalidData } } struct StackItem { object_refs: Vec<u64>, ty: StackType, } enum StackType { Array, Dict, Root, } /// https://opensource.apple.com/source/CF/CF-550/CFBinaryPList.c /// https://hg.python.org/cpython/file/3.4/Lib/plistlib.py pub struct EventReader<R> { stack: Vec<StackItem>, object_offsets: Vec<u64>, reader: R, ref_size: u8, finished: bool, // The largest single allocation allowed for this Plist. // Equal to the number of bytes in the Plist minus the magic and trailer. max_allocation_bytes: usize, // The maximum number of nested arrays and dicts allowed in the plist. max_stack_depth: usize, // The maximum number of objects that can be created. Default 10 * object_offsets.len(). // Binary plists can contain circular references. max_objects: usize, // The number of objects created so far. current_objects: usize, } impl<R: Read + Seek> EventReader<R> { pub fn new(reader: R) -> EventReader<R> { EventReader { stack: Vec::new(), object_offsets: Vec::new(), reader: reader, ref_size: 0, finished: false, max_allocation_bytes: 0, max_stack_depth: 200, max_objects: 0, current_objects: 0, } } fn can_allocate(&self, len: u64, size: usize) -> bool { let byte_len = len.saturating_mul(size as u64); byte_len <= self.max_allocation_bytes as u64 } fn allocate_vec<T>(&self, len: u64, size: usize) -> Result<Vec<T>> { if self.can_allocate(len, size) { Ok(Vec::with_capacity(len as usize)) } else { Err(Error::InvalidData) } } fn read_trailer(&mut self) -> Result<()> { self.reader.seek(SeekFrom::Start(0))?; let mut magic = [0; 8]; self.reader.read_exact(&mut magic)?; if &magic != b"bplist00" { return Err(Error::InvalidData); } // Trailer starts with 6 bytes of padding let trailer_start = self.reader.seek(SeekFrom::End(-32 + 6))?; let offset_size = self.reader.read_u8()?; match offset_size { 1 | 2 | 4 | 8 => (), _ => return Err(Error::InvalidData) } self.ref_size = self.reader.read_u8()?; match self.ref_size { 1 | 2 | 4 | 8 => (), _ => return Err(Error::InvalidData) } let num_objects = self.reader.read_u64::<BigEndian>()?; let top_object = self.reader.read_u64::<BigEndian>()?; let offset_table_offset = self.reader.read_u64::<BigEndian>()?; // File size minus trailer and header // Truncated to max(usize) self.max_allocation_bytes = trailer_start.saturating_sub(8) as usize; // Read offset table self.reader.seek(SeekFrom::Start(offset_table_offset))?; self.object_offsets = self.read_ints(num_objects, offset_size)?; self.max_objects = self.object_offsets.len() * 10; // Seek to top object self.stack.push(StackItem { object_refs: vec![top_object], ty: StackType::Root, }); Ok(()) } fn read_ints(&mut self, len: u64, size: u8) -> Result<Vec<u64>> { let mut ints = self.allocate_vec(len, size as usize)?; for _ in 0..len { match size { 1 => ints.push(self.reader.read_u8()? as u64), 2 => ints.push(self.reader.read_u16::<BigEndian>()? as u64), 4 => ints.push(self.reader.read_u32::<BigEndian>()? as u64), 8 => ints.push(self.reader.read_u64::<BigEndian>()? as u64), _ => return Err(Error::InvalidData), } } Ok(ints) } fn read_refs(&mut self, len: u64) -> Result<Vec<u64>> { let ref_size = self.ref_size; self.read_ints(len, ref_size) } fn read_object_len(&mut self, len: u8) -> Result<u64> { if (len & 0x0f) == 0x0f { let len_power_of_two = self.reader.read_u8()? & 0x03; Ok(match len_power_of_two { 0 => self.reader.read_u8()? as u64, 1 => self.reader.read_u16::<BigEndian>()? as u64, 2 => self.reader.read_u32::<BigEndian>()? as u64, 3 => self.reader.read_u64::<BigEndian>()?, _ => return Err(Error::InvalidData), }) } else { Ok(len as u64) } } fn read_data(&mut self, len: u64) -> Result<Vec<u8>> { let mut data = self.allocate_vec(len, size_of::<u8>())?; // Safe as u8 is a Copy type and we have already know len has been allocated. unsafe { data.set_len(len as usize) } self.reader.read_exact(&mut data)?; Ok(data) } fn seek_to_object(&mut self, object_ref: u64) -> Result<u64> { let object_ref = u64_to_usize(object_ref)?; let offset = *self.object_offsets.get(object_ref).ok_or(Error::InvalidData)?; Ok(self.reader.seek(SeekFrom::Start(offset))?) } fn read_next(&mut self) -> Result<Option<PlistEvent>> { if self.ref_size == 0 { // Initialise here rather than in new self.read_trailer()?; } let object_ref = match self.stack.last_mut() { Some(stack_item) => stack_item.object_refs.pop(), // Reached the end of the plist None => return Ok(None), }; match object_ref { Some(object_ref) => { if self.current_objects > self.max_objects { return Err(Error::InvalidData); } self.current_objects += 1; self.seek_to_object(object_ref)?; } None => { // We're at the end of an array or dict. Pop the top stack item and return let item = self.stack.pop().unwrap(); match item.ty { StackType::Array => return Ok(Some(PlistEvent::EndArray)), StackType::Dict => return Ok(Some(PlistEvent::EndDictionary)), // We're at the end of the plist StackType::Root => return Ok(None), } } } let token = self.reader.read_u8()?; let ty = (token & 0xf0) >> 4; let size = token & 0x0f; let result = match (ty, size) { (0x0, 0x00) => return Err(Error::InvalidData), // null (0x0, 0x08) => Some(PlistEvent::BooleanValue(false)), (0x0, 0x09) => Some(PlistEvent::BooleanValue(true)), (0x0, 0x0f) => return Err(Error::InvalidData), // fill (0x1, 0) => Some(PlistEvent::IntegerValue(self.reader.read_u8()? as i64)), (0x1, 1) => Some(PlistEvent::IntegerValue(self.reader.read_u16::<BigEndian>()? as i64)), (0x1, 2) => Some(PlistEvent::IntegerValue(self.reader.read_u32::<BigEndian>()? as i64)), (0x1, 3) => Some(PlistEvent::IntegerValue(self.reader.read_i64::<BigEndian>()?)), (0x1, 4) => return Err(Error::InvalidData), // 128 bit int (0x1, _) => return Err(Error::InvalidData), // variable length int (0x2, 2) => Some(PlistEvent::RealValue(self.reader.read_f32::<BigEndian>()? as f64)), (0x2, 3) => Some(PlistEvent::RealValue(self.reader.read_f64::<BigEndian>()?)), (0x2, _) => return Err(Error::InvalidData), // odd length float (0x3, 3) => { // Date. Seconds since 1/1/2001 00:00:00. let secs = self.reader.read_f64::<BigEndian>()?; Some(PlistEvent::DateValue(Date::from_seconds_since_plist_epoch(secs)?)) } (0x4, n) => { // Data let len = self.read_object_len(n)?; Some(PlistEvent::DataValue(self.read_data(len)?)) } (0x5, n) => { // ASCII string let len = self.read_object_len(n)?; let raw = self.read_data(len)?; let string = String::from_utf8(raw)?; Some(PlistEvent::StringValue(string)) } (0x6, n) => { // UTF-16 string let len_utf16_codepoints = self.read_object_len(n)?; let mut raw_utf16 = self.allocate_vec(len_utf16_codepoints, size_of::<u16>())?; for _ in 0..len_utf16_codepoints { raw_utf16.push(self.reader.read_u16::<BigEndian>()?); } let string = String::from_utf16(&raw_utf16)?; Some(PlistEvent::StringValue(string)) } (0xa, n) => { // Array let len = self.read_object_len(n)?; let mut object_refs = self.read_refs(len)?; // Reverse so we can pop off the end of the stack in order object_refs.reverse(); self.stack.push(StackItem { ty: StackType::Array, object_refs: object_refs, }); Some(PlistEvent::StartArray(Some(len))) } (0xd, n) => { // Dict let len = self.read_object_len(n)?; let key_refs = self.read_refs(len)?; let value_refs = self.read_refs(len)?; let mut object_refs = self.allocate_vec(len * 2, self.ref_size as usize)?; let len = key_refs.len(); for i in 1..len + 1 { // Reverse so we can pop off the end of the stack in order object_refs.push(value_refs[len - i]); object_refs.push(key_refs[len - i]); } self.stack.push(StackItem { ty: StackType::Dict, object_refs: object_refs, }); Some(PlistEvent::StartDictionary(Some(len as u64))) } (_, _) => return Err(Error::InvalidData), }; // Prevent stack overflows when recursively parsing plist. if self.stack.len() > self.max_stack_depth { return Err(Error::InvalidData); } Ok(result) } } impl<R: Read + Seek> Iterator for EventReader<R> { type Item = Result<PlistEvent>; fn next(&mut self) -> Option<Result<PlistEvent>> { if self.finished { None } else { match self.read_next() { Ok(Some(event)) => Some(Ok(event)), Err(err) => { self.finished = true; Some(Err(err)) } Ok(None) => { self.finished = true; None } } } } } #[cfg(test)] mod tests { use chrono::{TimeZone, Utc}; use std::fs::File; use std::path::Path; use super::*; use PlistEvent; #[test] fn streaming_parser() { use PlistEvent::*; let reader = File::open(&Path::new("./tests/data/binary.plist")).unwrap(); let streaming_parser = EventReader::new(reader); let events: Vec<PlistEvent> = streaming_parser.map(|e| e.unwrap()).collect(); let comparison = &[StartDictionary(Some(6)), StringValue("Lines".to_owned()), StartArray(Some(2)), StringValue("It is a tale told by an idiot,".to_owned()), StringValue("Full of sound and fury, signifying nothing.".to_owned()), EndArray, StringValue("Death".to_owned()), IntegerValue(1564), StringValue("Height".to_owned()), RealValue(1.60), StringValue("Birthdate".to_owned()), DateValue(Utc.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), StringValue("Author".to_owned()), StringValue("William Shakespeare".to_owned()), StringValue("Data".to_owned()), DataValue(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]), EndDictionary]; assert_eq!(events, comparison); } #[test] fn utf16_plist() { use PlistEvent::*; let reader = File::open(&Path::new("./tests/data/utf16_bplist.plist")).unwrap(); let streaming_parser = EventReader::new(reader); let mut events: Vec<PlistEvent> = streaming_parser.map(|e| e.unwrap()).collect(); assert_eq!(events[2], StringValue("\u{2605} or better".to_owned())); let poem = if let StringValue(ref mut poem) = events[4] { poem } else { panic!("not a string") }; assert_eq!(poem.len(), 643); assert_eq!(poem.pop().unwrap(), '\u{2605}'); } }
// 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 std::{cell::RefCell, rc::Rc}; use crate::{ context::{Context, ContextInner}, path::Path, spinel_sys::*, Point, }; #[derive(Clone, Debug)] enum PathCommand { Move(Point), Line(Point), Quad([Point; 2]), QuadSmooth(Point), Cubic([Point; 3]), CubicSmooth([Point; 2]), RatQuad([Point; 2], f32), RatCubic([Point; 3], f32, f32), } /// Spinel `Path` builder. /// /// Is actually a thin wrapper over the [spn_path_builder_t] stored in [`Context`]. /// /// [spn_path_builder_t]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#34 /// /// # Examples /// /// ```no_run /// # use spinel_rs::{Context, PathBuilder, Point}; /// # /// # fn catch() -> Option<()> { /// # let context: Context = unimplemented!(); /// # /// let tl = Point { x: 1.0, y: 1.0 }; /// let tr = Point { x: 5.0, y: 1.0 }; /// let br = Point { x: 5.0, y: 5.0 }; /// let bl = Point { x: 1.0, y: 5.0 }; /// /// let rectangle = PathBuilder::new(&context, tl) /// .line_to(tr) /// .line_to(br) /// .line_to(bl) /// .line_to(tl) /// .build()?; /// # None /// # } /// ``` #[derive(Clone, Debug)] pub struct PathBuilder { context: Rc<RefCell<ContextInner>>, cmds: Vec<PathCommand>, } macro_rules! panic_if_not_finite { ( $point:expr ) => { if !$point.is_finite() { panic!("{:?} does not have finite f32 values", $point); } }; } impl PathBuilder { /// Creates a new path builder that keeps track of an `end-point` which is the last point of the /// path used in subsequent calls. /// /// `start_point` is the first `end-point`. [spn_path_move_to] /// /// [spn_path_move_to]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#73 pub fn new(context: &Context, start_point: Point) -> Self { Self { context: Rc::clone(&context.inner), cmds: vec![PathCommand::Move(start_point)] } } /// Adds line from `end-point` to `point`. [spn_path_line_to] /// /// [spn_path_line_to]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#77 pub fn line_to(mut self, point: Point) -> Self { panic_if_not_finite!(point); self.cmds.push(PathCommand::Line(point)); self } /// Adds quadratic Bézier from `end-point` to `point[1]` with `point[0]` as a control point. /// [spn_path_quad_to] /// /// [spn_path_quad_to]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#92 pub fn quad_to(mut self, points: [Point; 2]) -> Self { for point in &points { panic_if_not_finite!(point); } self.cmds.push(PathCommand::Quad(points)); self } /// Adds smooth quadratic Bézier from `end-point` to `point`. [spn_path_quad_smooth_to] /// /// [spn_path_quad_smooth_to]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#97 pub fn quad_smooth_to(mut self, point: Point) -> Self { panic_if_not_finite!(point); self.cmds.push(PathCommand::QuadSmooth(point)); self } /// Adds cubic Bézier from `end-point` to `point[2]` with `point[0]` and `point[1]` as control /// points. [spn_path_cubic_to] /// /// [spn_path_cubic_to]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#81 pub fn cubic_to(mut self, points: [Point; 3]) -> Self { for point in &points { panic_if_not_finite!(point); } self.cmds.push(PathCommand::Cubic(points)); self } /// Adds smooth cubic Bézier from `end-point` to `point[1]` with `point[0]` as control point. /// [spn_path_cubic_smooth_to] /// /// [spn_path_cubic_smooth_to]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#87 pub fn cubic_smooth_to(mut self, points: [Point; 2]) -> Self { for point in &points { panic_if_not_finite!(point); } self.cmds.push(PathCommand::CubicSmooth(points)); self } /// Adds rational quadratic Bézier from `end-point` to `point[1]` with `point[0]` as a control /// point and `w0` as weight. [spn_path_rat_quad_to] /// /// [spn_path_rat_quad_to]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#101 pub fn rat_quad_to(mut self, points: [Point; 2], w0: f32) -> Self { for point in &points { panic_if_not_finite!(point); } if !w0.is_finite() { panic!("{} (w0) is not finite", w0); } self.cmds.push(PathCommand::RatQuad(points, w0)); self } /// Adds rational cubic Bézier from `end-point` to `point[2]` with `point[0]` and `point[1]` as /// control points, and `w0` and `w1` as weights. [spn_path_rat_cubic_to] /// /// [spn_path_rat_cubic_to]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#107 pub fn rat_cubic_to(mut self, points: [Point; 3], w0: f32, w1: f32) -> Self { for point in &points { panic_if_not_finite!(point); } if !w0.is_finite() { panic!("{} (w0) is not finite", w0); } if !w1.is_finite() { panic!("{} (w1) is not finite", w1); } self.cmds.push(PathCommand::RatCubic(points, w0, w1)); self } fn end_point(&self) -> Point { match self.cmds.last().expect("PathBuilder should always be initialized with Move") { PathCommand::Move(p) => *p, PathCommand::Line(p) => *p, PathCommand::Quad(points) => points[1], PathCommand::QuadSmooth(p) => *p, PathCommand::Cubic(points) => points[2], PathCommand::CubicSmooth(points) => points[1], PathCommand::RatQuad(points, ..) => points[1], PathCommand::RatCubic(points, ..) => points[2], } } /// Builds `Path`. Calls [spn_path_begin] and [spn_path_end] to allocate the path. /// /// If the path is not closed, a straight line will be added to connect the end-point back to /// the start-point. /// /// If there is not enough memory to allocate the path, `None` is returned instead. /// /// [spn_path_begin]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#55 /// [spn_path_end]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#58 pub fn build(mut self) -> Option<Path> { macro_rules! success { ( $result:expr, $path_builder:expr $( , )? ) => {{ if let Err(SpnError::SpnErrorPathBuilderLost) = $result.res() { $path_builder.context.borrow_mut().reset_path_builder(); return None; } $result.success(); }}; } unsafe { let spn_path_builder = self.context.borrow().spn_path_builder; success!(spn_path_begin(spn_path_builder), self); let start_point = match self.cmds[0] { PathCommand::Move(p) => p, _ => panic!("PathBuilder should always be initialized with Move"), }; let end_point = self.end_point(); // If path is not closed, close it with a line. if !start_point.approx_eq(end_point) { self.cmds.push(PathCommand::Line(start_point)); } for cmd in self.cmds { match cmd { PathCommand::Move(p) => { success!(spn_path_move_to(spn_path_builder, p.x, p.y), self,) } PathCommand::Line(p) => { success!(spn_path_line_to(spn_path_builder, p.x, p.y), self,) } PathCommand::Quad([p1, p2]) => { success!(spn_path_quad_to(spn_path_builder, p1.x, p1.y, p2.x, p2.y), self,) } PathCommand::QuadSmooth(p) => { success!(spn_path_quad_smooth_to(spn_path_builder, p.x, p.y), self,) } PathCommand::Cubic([p1, p2, p3]) => success!( spn_path_cubic_to(spn_path_builder, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y), self, ), PathCommand::CubicSmooth([p2, p3]) => success!( spn_path_cubic_smooth_to(spn_path_builder, p2.x, p2.y, p3.x, p3.y), self, ), PathCommand::RatQuad([p1, p2], w0) => success!( spn_path_rat_quad_to(spn_path_builder, p1.x, p1.y, p2.x, p2.y, w0), self, ), PathCommand::RatCubic([p1, p2, p3], w0, w1) => success!( spn_path_rat_cubic_to( spn_path_builder, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, w0, w1, ), self, ), } } let mut spn_path = Default::default(); success!(spn_path_end(spn_path_builder, &mut spn_path as *mut _), self); Some(Path::new(&self.context, spn_path)) } } } #[cfg(test)] mod tests { use std::f32; use super::*; const FINITE: Point = Point { x: 0.0, y: 1.0 }; const X_NAN: Point = Point { x: f32::NAN, y: 1.0 }; const Y_INF: Point = Point { x: 0.0, y: f32::INFINITY }; fn new_path_builder() -> PathBuilder { let context = Context::new(); PathBuilder::new(&context, Point::default()) } #[test] fn point_is_finite() { assert!(FINITE.is_finite()); assert!(!X_NAN.is_finite()); assert!(!Y_INF.is_finite()); } #[test] fn line_to_finite() { let path_builder = new_path_builder(); path_builder.line_to(FINITE); } #[test] #[should_panic] fn line_to_non_finite() { let path_builder = new_path_builder(); path_builder.line_to(X_NAN); } #[test] fn quad_to_finite() { let path_builder = new_path_builder(); path_builder.quad_to([FINITE, FINITE]); } #[test] #[should_panic] fn quad_to_non_finite() { let path_builder = new_path_builder(); path_builder.quad_to([X_NAN, FINITE]); } #[test] fn quad_smooth_to_finite() { let path_builder = new_path_builder(); path_builder.quad_smooth_to(FINITE); } #[test] #[should_panic] fn quad_smooth_to_non_finite() { let path_builder = new_path_builder(); path_builder.quad_smooth_to(X_NAN); } #[test] fn cubic_to_finite() { let path_builder = new_path_builder(); path_builder.cubic_to([FINITE, FINITE, FINITE]); } #[test] #[should_panic] fn cubic_to_non_finite() { let path_builder = new_path_builder(); path_builder.cubic_to([X_NAN, FINITE, FINITE]); } #[test] fn cubic_smooth_to_finite() { let path_builder = new_path_builder(); path_builder.cubic_smooth_to([FINITE, FINITE]); } #[test] #[should_panic] fn cubic_smooth_to_non_finite() { let path_builder = new_path_builder(); path_builder.cubic_smooth_to([X_NAN, FINITE]); } #[test] fn rat_quad_to_finite() { let path_builder = new_path_builder(); path_builder.rat_quad_to([FINITE, FINITE], 0.0); } #[test] #[should_panic] fn rat_quad_to_non_finite_points() { let path_builder = new_path_builder(); path_builder.rat_quad_to([X_NAN, FINITE], 0.0); } #[test] #[should_panic] fn rat_quad_to_non_finite_w0() { let path_builder = new_path_builder(); path_builder.rat_quad_to([FINITE, FINITE], f32::NAN); } #[test] fn rat_cubic_to_finite() { let path_builder = new_path_builder(); path_builder.rat_cubic_to([FINITE, FINITE, FINITE], 0.0, 0.0); } #[test] #[should_panic] fn rat_cubic_to_non_finite_points() { let path_builder = new_path_builder(); path_builder.rat_cubic_to([X_NAN, FINITE, FINITE], 0.0, 0.0); } #[test] #[should_panic] fn rat_cubic_to_non_finite_w0() { let path_builder = new_path_builder(); path_builder.rat_cubic_to([FINITE, FINITE, FINITE], f32::NAN, 0.0); } #[test] #[should_panic] fn rat_cubic_to_non_finite_w1() { let path_builder = new_path_builder(); path_builder.rat_cubic_to([FINITE, FINITE, FINITE], 0.0, f32::NAN); } }
use flatgeobuf::*; use geozero::error::Result; use geozero::GeomProcessor; use pathfinder_canvas::{Canvas, CanvasFontContext, CanvasRenderingContext2D, Path2D}; use pathfinder_color::{rgbu, ColorF}; use pathfinder_content::fill::FillRule; use pathfinder_geometry::vector::{vec2f, vec2i, Vector2F, Vector2I}; use pathfinder_gl::{GLDevice, GLVersion}; use pathfinder_renderer::concurrent::rayon::RayonExecutor; use pathfinder_renderer::concurrent::scene_proxy::SceneProxy; use pathfinder_renderer::gpu::options::{DestFramebuffer, RendererOptions}; use pathfinder_renderer::gpu::renderer::Renderer; use pathfinder_renderer::options::BuildOptions; use pathfinder_resources::embedded::EmbeddedResourceLoader; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::video::GLProfile; use std::fs::File; use std::io::BufReader; use std::mem; use std::time::Instant; mod ui; const DEFAULT_WINDOW_WIDTH: i32 = 1067; const DEFAULT_WINDOW_HEIGHT: i32 = 800; fn main() -> Result<()> { let fname = std::env::args() .nth(1) .expect("FlatGeobuf file name expceted"); // Set up SDL2. let sdl_context = sdl2::init().unwrap(); let video = sdl_context.video().unwrap(); // Make sure we have at least a GL 3.0 context. Pathfinder requires this. let gl_attributes = video.gl_attr(); gl_attributes.set_context_profile(GLProfile::Core); gl_attributes.set_context_version(3, 3); // Open a window. let window_size = vec2i(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); let window = video .window( "FlatGeobuf Demo", window_size.x() as u32, window_size.y() as u32, ) .opengl() .build() .unwrap(); // Create the GL context, and make it current. let gl_context = window.gl_create_context().unwrap(); gl::load_with(|name| video.gl_get_proc_address(name) as *const _); window.gl_make_current(&gl_context).unwrap(); // Create a Pathfinder renderer. let renderer = Renderer::new( GLDevice::new(GLVersion::GL3, 0), &EmbeddedResourceLoader::new(), DestFramebuffer::full_window(window_size), RendererOptions { background_color: Some(ColorF::white()), }, ); let mut fgb_renderer = FgbRenderer::new(renderer, window_size, fname, vec2f(8.53, 47.37)); fgb_renderer.render()?; window.gl_swap_window(); // Enter main render loop. let mut event_pump = sdl_context.event_pump().unwrap(); loop { let ev = event_pump.wait_event(); match fgb_renderer.handle_event(ev) { AppEvent::Idle => {} AppEvent::Redraw => { fgb_renderer.render()?; window.gl_swap_window(); } AppEvent::Quit => return Ok(()), } } } struct FgbRenderer { fname: String, renderer: Renderer<GLDevice>, scene: SceneProxy, window_size: Vector2I, center: Vector2F, /// Size of center pixel in map coordinates pixel_size: Vector2F, } enum AppEvent { Idle, Redraw, Quit, } struct PathDrawer<'a> { xmin: f32, ymax: f32, pixel_size: Vector2F, canvas: &'a mut CanvasRenderingContext2D, path: Path2D, } impl<'a> GeomProcessor for PathDrawer<'a> { fn xy(&mut self, x: f64, y: f64, idx: usize) -> Result<()> { // x,y are in degrees, y must be inverted let x = (x as f32 - self.xmin) / self.pixel_size.x(); let y = (self.ymax - y as f32) / self.pixel_size.y(); if idx == 0 { self.path.move_to(vec2f(x, y)); } else { self.path.line_to(vec2f(x, y)); } Ok(()) } fn linestring_end(&mut self, _tagged: bool, _idx: usize) -> Result<()> { self.path.close_path(); self.canvas.fill_path( mem::replace(&mut self.path, Path2D::new()), FillRule::Winding, ); Ok(()) } } impl FgbRenderer { fn new( renderer: Renderer<GLDevice>, window_size: Vector2I, fname: String, center: Vector2F, ) -> FgbRenderer { let pixel_size = vec2f(0.00003, 0.00003); // TODO: calculate from scale and center FgbRenderer { fname, renderer, scene: SceneProxy::new(RayonExecutor), window_size, center, pixel_size, } } fn render(&mut self) -> Result<()> { let font_context = CanvasFontContext::from_system_source(); let stats_ui_presenter = ui::StatsUIPresenter::new( &self.renderer.device, &EmbeddedResourceLoader::new(), self.window_size, ); let mut canvas = Canvas::new(self.window_size.to_f32()).get_context_2d(font_context); canvas.set_line_width(1.0); canvas.set_fill_style(rgbu(132, 132, 132)); let mut stats = ui::Stats::default(); let start = Instant::now(); let mut file = BufReader::new(File::open(self.fname.clone())?); let mut fgb = FgbReader::open(&mut file)?; let geometry_type = fgb.header().geometry_type(); let wsize = vec2f(self.window_size.x() as f32, self.window_size.y() as f32); // let bbox = (-180.0, -90.0, 180.0, 90.0); let bbox = ( self.center.x() - wsize.x() / 2.0 * self.pixel_size.x(), self.center.y() - wsize.y() / 2.0 * self.pixel_size.y(), self.center.x() + wsize.x() / 2.0 * self.pixel_size.x(), self.center.y() + wsize.y() / 2.0 * self.pixel_size.y(), ); let mut drawer = PathDrawer { xmin: bbox.0, ymax: bbox.3, pixel_size: self.pixel_size, canvas: &mut canvas, path: Path2D::new(), }; fgb.select_bbox(bbox.0 as f64, bbox.1 as f64, bbox.2 as f64, bbox.3 as f64)?; stats.fbg_index_read_time = start.elapsed(); stats.feature_count = fgb.features_count(); let start = Instant::now(); while let Some(feature) = fgb.next()? { let geometry = feature.geometry().unwrap(); geometry.process(&mut drawer, geometry_type)?; } stats.fbg_data_read_time = start.elapsed(); // Render the canvas to screen. let start = Instant::now(); self.scene.replace_scene(canvas.into_canvas().into_scene()); self.scene .build_and_render(&mut self.renderer, BuildOptions::default()); stats.render_time = start.elapsed(); stats_ui_presenter.draw_stats_window(&self.renderer.device, &stats); Ok(()) } fn handle_event(&mut self, event: Event) -> AppEvent { match event { Event::Quit { .. } | Event::KeyDown { keycode: Some(Keycode::Escape), .. } => { return AppEvent::Quit; } Event::MouseMotion { xrel, yrel, mousestate, .. } => { if mousestate.left() { self.move_center(xrel, yrel); } } Event::MouseButtonUp { x: _, y: _, .. } => { return AppEvent::Redraw; } _ => {} } AppEvent::Idle } fn move_center(&mut self, xrel: i32, yrel: i32) { self.center += vec2f( xrel as f32 * -self.pixel_size.x(), yrel as f32 * self.pixel_size.y(), ); } }
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub cr1: CR1, #[doc = "0x04 - Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub cr2: CR2, #[doc = "0x08 - Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub oar1: OAR1, #[doc = "0x0c - Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub oar2: OAR2, #[doc = "0x10 - Access: No wait states"] pub timingr: TIMINGR, #[doc = "0x14 - Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub timeoutr: TIMEOUTR, #[doc = "0x18 - Access: No wait states"] pub isr: ISR, #[doc = "0x1c - Access: No wait states"] pub icr: ICR, #[doc = "0x20 - Access: No wait states"] pub pecr: PECR, #[doc = "0x24 - Access: No wait states"] pub rxdr: RXDR, #[doc = "0x28 - Access: No wait states"] pub txdr: TXDR, } #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr1](cr1) module"] pub type CR1 = crate::Reg<u32, _CR1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _CR1; #[doc = "`read()` method returns [cr1::R](cr1::R) reader structure"] impl crate::Readable for CR1 {} #[doc = "`write(|w| ..)` method takes [cr1::W](cr1::W) writer structure"] impl crate::Writable for CR1 {} #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub mod cr1; #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr2](cr2) module"] pub type CR2 = crate::Reg<u32, _CR2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _CR2; #[doc = "`read()` method returns [cr2::R](cr2::R) reader structure"] impl crate::Readable for CR2 {} #[doc = "`write(|w| ..)` method takes [cr2::W](cr2::W) writer structure"] impl crate::Writable for CR2 {} #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub mod cr2; #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [oar1](oar1) module"] pub type OAR1 = crate::Reg<u32, _OAR1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _OAR1; #[doc = "`read()` method returns [oar1::R](oar1::R) reader structure"] impl crate::Readable for OAR1 {} #[doc = "`write(|w| ..)` method takes [oar1::W](oar1::W) writer structure"] impl crate::Writable for OAR1 {} #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub mod oar1; #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [oar2](oar2) module"] pub type OAR2 = crate::Reg<u32, _OAR2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _OAR2; #[doc = "`read()` method returns [oar2::R](oar2::R) reader structure"] impl crate::Readable for OAR2 {} #[doc = "`write(|w| ..)` method takes [oar2::W](oar2::W) writer structure"] impl crate::Writable for OAR2 {} #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub mod oar2; #[doc = "Access: No wait states\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [timingr](timingr) module"] pub type TIMINGR = crate::Reg<u32, _TIMINGR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _TIMINGR; #[doc = "`read()` method returns [timingr::R](timingr::R) reader structure"] impl crate::Readable for TIMINGR {} #[doc = "`write(|w| ..)` method takes [timingr::W](timingr::W) writer structure"] impl crate::Writable for TIMINGR {} #[doc = "Access: No wait states"] pub mod timingr; #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [timeoutr](timeoutr) module"] pub type TIMEOUTR = crate::Reg<u32, _TIMEOUTR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _TIMEOUTR; #[doc = "`read()` method returns [timeoutr::R](timeoutr::R) reader structure"] impl crate::Readable for TIMEOUTR {} #[doc = "`write(|w| ..)` method takes [timeoutr::W](timeoutr::W) writer structure"] impl crate::Writable for TIMEOUTR {} #[doc = "Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK."] pub mod timeoutr; #[doc = "Access: No wait states\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [isr](isr) module"] pub type ISR = crate::Reg<u32, _ISR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _ISR; #[doc = "`read()` method returns [isr::R](isr::R) reader structure"] impl crate::Readable for ISR {} #[doc = "`write(|w| ..)` method takes [isr::W](isr::W) writer structure"] impl crate::Writable for ISR {} #[doc = "Access: No wait states"] pub mod isr; #[doc = "Access: No wait states\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [icr](icr) module"] pub type ICR = crate::Reg<u32, _ICR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _ICR; #[doc = "`write(|w| ..)` method takes [icr::W](icr::W) writer structure"] impl crate::Writable for ICR {} #[doc = "Access: No wait states"] pub mod icr; #[doc = "Access: No wait states\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pecr](pecr) module"] pub type PECR = crate::Reg<u32, _PECR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _PECR; #[doc = "`read()` method returns [pecr::R](pecr::R) reader structure"] impl crate::Readable for PECR {} #[doc = "Access: No wait states"] pub mod pecr; #[doc = "Access: No wait states\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [rxdr](rxdr) module"] pub type RXDR = crate::Reg<u32, _RXDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _RXDR; #[doc = "`read()` method returns [rxdr::R](rxdr::R) reader structure"] impl crate::Readable for RXDR {} #[doc = "Access: No wait states"] pub mod rxdr; #[doc = "Access: No wait states\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [txdr](txdr) module"] pub type TXDR = crate::Reg<u32, _TXDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _TXDR; #[doc = "`read()` method returns [txdr::R](txdr::R) reader structure"] impl crate::Readable for TXDR {} #[doc = "`write(|w| ..)` method takes [txdr::W](txdr::W) writer structure"] impl crate::Writable for TXDR {} #[doc = "Access: No wait states"] pub mod txdr;
use std::ops::{ Index, IndexMut }; /// Represents an input or output buffer to a cryptographic function. pub struct Parameter { name: String, length: usize, data: Vec<u8> } impl Parameter { /// Create a parameter with a particular name and length. pub fn new<T>(name: T, length: usize) -> Parameter where String: From<T> { Parameter { name: String::from(name), length: length, data: vec![0u8; length] } } /// Retrieve the parameter's name. pub fn name(&self) -> String { self.name.clone() } /// Retrieve the parameter's length. pub fn length(&self) -> usize { self.length } } impl Index<usize> for Parameter { type Output = u8; fn index(&self, index: usize) -> &u8 { &self.data[index] } } impl IndexMut<usize> for Parameter { fn index_mut(&mut self, index: usize) -> &mut u8 { &mut self.data[index] } } #[cfg(test)] mod tests { use super::Parameter; #[test] fn getname_str() { let p = Parameter::new("a", 1); assert!(p.name() == "a"); } #[test] fn getname_string() { let p = Parameter::new("a".to_string(), 1); assert!(p.name() == "a"); } #[test] fn getlen() { let p = Parameter::new("a", 1); let q = Parameter::new("b", 128); assert!(p.length() == 1); assert!(q.length() == 128); } #[test] fn indexing() { let mut p = Parameter::new("a", 10); p[0] = 0x00; assert!(p[0] == 0x00); p[0] = 0xff; assert!(p[0] == 0xff); p[9] = 0x00; assert!(p[9] == 0x00); p[9] = 0xff; assert!(p[9] == 0xff); } #[test] #[should_panic] fn oob() { let p = Parameter::new("a", 1); let x = p[2]; println!("{}", x); } #[test] #[should_panic] fn oob_mut() { let mut p = Parameter::new("a", 1); p[2] = 0xff; } }
#[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Self wake-up timer control register."] pub ctrl: CTRL, _reserved0: [u8; 8usize], #[doc = "0x0c - Counter register."] pub count: COUNT, } #[doc = "Self wake-up timer control register."] pub struct CTRL { register: ::vcell::VolatileCell<u32>, } #[doc = "Self wake-up timer control register."] pub mod ctrl; #[doc = "Counter register."] pub struct COUNT { register: ::vcell::VolatileCell<u32>, } #[doc = "Counter register."] pub mod count;
use std::collections::HashSet; use std::io::{BufRead, stdin}; use std::fmt::Write; fn main() { let stdin = stdin(); let mut iterator = stdin.lock().lines(); let mut students: HashSet<i32> = (1..31).collect(); for _i in 0..28 { let value: i32 = iterator.next().unwrap().unwrap().parse().unwrap(); students.remove(&value); } let mut output = String::new(); let mut vector = Vec::new(); for v in students.iter() { vector.push(v); } vector.sort(); write!(output, "{}\n{}", vector[0], vector[1]).unwrap(); println!("{}", output); }
#[macro_use] extern crate redis_module; use redis_module::{Context, NextArg, RedisError, RedisResult}; use redisearch_api::{init, Document, FieldType, Index, TagOptions}; fn hello_redisearch(_: &Context, args: Vec<String>) -> RedisResult { let mut args = args.into_iter().skip(1); let search_term = args.next_string()?; // FT.CREATE my_index // SCHEMA // $a.b.c TEXT WEIGHT 5.0 // $a.b.d TEXT // $b.a TEXT // see RediSearch: t_llapi.cpp let index_name = "index"; let field_name = "foo"; let score = 1.0; let index = Index::create(index_name); index.create_field(field_name, 1.0, TagOptions::default()); let doc = Document::create("doc1", score); doc.add_field(field_name, "bar", FieldType::FULLTEXT); index.add_document(&doc)?; let doc2 = Document::create("doc2", score); doc2.add_field(field_name, "quux", FieldType::FULLTEXT); index.add_document(&doc2)?; let keys: Vec<_> = index.search(search_term.as_str())?.collect(); Ok(keys.into()) } redis_module! { name: "hello_redisearch", version: 1, data_types: [], init: init, commands: [ ["hello_redisearch", hello_redisearch, "readonly", 1, 1, 1], ], }
use std::env; use std::collections::BTreeMap; fn main() { let mut data = BTreeMap::new(); for envvar in env::vars() { data.insert(envvar.0, envvar.1); } println!("{}", serde_json::to_string(&data).unwrap()); }
//! Log and trace initialization and setup #![deny(broken_intra_doc_links, rust_2018_idioms)] #![warn( missing_copy_implementations, missing_debug_implementations, clippy::explicit_iter_loop, clippy::future_not_send, clippy::use_self, clippy::clone_on_ref_ptr )] #[cfg(feature = "structopt")] pub mod cli; pub mod config; pub use config::*; use observability_deps::{ opentelemetry, opentelemetry::sdk::trace, opentelemetry::sdk::Resource, opentelemetry::KeyValue, tracing::{self, Subscriber}, tracing_subscriber::{ self, fmt::{self, writer::BoxMakeWriter, MakeWriter}, layer::SubscriberExt, EnvFilter, }, }; use std::io; use thiserror::Error; #[derive(Debug, Error)] pub enum Error { #[error("Jaeger exporter selected but jaeger config passed to builder")] JaegerConfigMissing, #[error("OTLP exporter selected but OTLP config passed to builder")] OtlpConfigMissing, #[error("Cannot set global tracing subscriber")] SetGlobalDefaultError(#[from] tracing::dispatcher::SetGlobalDefaultError), } pub type Result<T, E = Error> = std::result::Result<T, E>; /// Builder for tracing and logging. #[derive(Debug)] pub struct Builder<W = fn() -> io::Stdout> { log_format: LogFormat, log_filter: Option<EnvFilter>, // used when log_filter is none. default_log_filter: EnvFilter, traces_filter: Option<EnvFilter>, traces_exporter: TracesExporter, traces_sampler: TracesSampler, traces_sampler_arg: f64, make_writer: W, with_target: bool, with_ansi: bool, jaeger_config: Option<JaegerConfig>, otlp_config: Option<OtlpConfig>, } impl Default for Builder { fn default() -> Self { Self { log_format: LogFormat::Full, log_filter: None, default_log_filter: EnvFilter::try_new(Self::DEFAULT_LOG_FILTER).unwrap(), traces_filter: None, traces_exporter: TracesExporter::None, traces_sampler: TracesSampler::ParentBasedTraceIdRatio, traces_sampler_arg: 1.0, make_writer: io::stdout, with_target: true, with_ansi: true, jaeger_config: None, otlp_config: None, } } } impl Builder { pub fn new() -> Self { Self::default() } } // This needs to be a separate impl block because they place different bounds on the type parameters. impl<W> Builder<W> { pub fn with_writer<W2>(self, make_writer: W2) -> Builder<W2> where W2: MakeWriter + Send + Sync + Clone + 'static, { Builder::<W2> { make_writer, // cannot use `..self` because W type parameter changes log_format: self.log_format, log_filter: self.log_filter, default_log_filter: self.default_log_filter, traces_filter: self.traces_filter, traces_exporter: self.traces_exporter, traces_sampler: self.traces_sampler, traces_sampler_arg: self.traces_sampler_arg, with_target: self.with_target, with_ansi: self.with_ansi, jaeger_config: self.jaeger_config, otlp_config: self.otlp_config, } } } // This needs to be a separate impl block because they place different bounds on the type parameters. impl<W> Builder<W> where W: MakeWriter + Send + Sync + 'static, { pub const DEFAULT_LOG_FILTER: &'static str = "warn"; /// Set log_filter using a simple numeric "verbosity level". /// /// 0 means, keep existing `log_filter` value. pub fn with_log_verbose_count(self, log_verbose_count: u8) -> Self { let log_filter = match log_verbose_count { 0 => self.log_filter, 1 => Some(EnvFilter::try_new("info").unwrap()), 2 => Some(EnvFilter::try_new("debug,hyper::proto::h1=info,h2=info").unwrap()), _ => Some(EnvFilter::try_new("trace,hyper::proto::h1=info,h2=info").unwrap()), }; Self { log_filter, ..self } } pub fn with_log_filter(self, log_filter: &Option<String>) -> Self { let log_filter = log_filter .as_ref() .map(|log_filter| EnvFilter::try_new(log_filter).unwrap()); Self { log_filter, ..self } } pub fn with_default_log_filter(self, default_log_filter: impl AsRef<str>) -> Self { let default_log_filter = EnvFilter::try_new(default_log_filter).unwrap(); Self { default_log_filter, ..self } } pub fn with_log_format(self, log_format: LogFormat) -> Self { Self { log_format, ..self } } pub fn with_log_destination(self, log_destination: LogDestination) -> Builder<BoxMakeWriter> { let make_writer = match log_destination { LogDestination::Stdout => { fmt::writer::BoxMakeWriter::new(|| std::io::LineWriter::new(std::io::stdout())) } LogDestination::Stderr => { fmt::writer::BoxMakeWriter::new(|| std::io::LineWriter::new(std::io::stderr())) } }; Builder { make_writer, // cannot use `..self` because W type parameter changes log_format: self.log_format, log_filter: self.log_filter, default_log_filter: self.default_log_filter, traces_filter: self.traces_filter, traces_exporter: self.traces_exporter, traces_sampler: self.traces_sampler, traces_sampler_arg: self.traces_sampler_arg, with_target: self.with_target, with_ansi: self.with_ansi, jaeger_config: self.jaeger_config, otlp_config: self.otlp_config, } } /// Sets whether or not an event’s target and location are displayed. /// /// Defaults to true. See [observability_deps::tracing_subscriber::fmt::Layer::with_target] pub fn with_target(self, with_target: bool) -> Self { Self { with_target, ..self } } /// Enable/disable ANSI encoding for formatted events (i.e. colors). /// /// Defaults to true. See [observability_deps::tracing_subscriber::fmt::Layer::with_ansi] pub fn with_ansi(self, with_ansi: bool) -> Self { Self { with_ansi, ..self } } /// Sets an optional event filter for the tracing pipeline. /// /// The filter will be parsed with [observability_deps::tracing_subscriber::EnvFilter] /// and applied to all events before they reach the tracing exporter. pub fn with_traces_filter(self, traces_filter: &Option<String>) -> Self { if let Some(traces_filter) = traces_filter { let traces_filter = EnvFilter::try_new(traces_filter).unwrap(); Self { traces_filter: Some(traces_filter), ..self } } else { self } } pub fn with_traces_exporter(self, traces_exporter: TracesExporter) -> Self { Self { traces_exporter, ..self } } pub fn with_traces_sampler( self, traces_sampler: TracesSampler, traces_sampler_arg: f64, ) -> Self { Self { traces_sampler, traces_sampler_arg, ..self } } pub fn with_jaeger_config(self, config: JaegerConfig) -> Self { Self { jaeger_config: Some(config), ..self } } pub fn with_oltp_config(self, config: OtlpConfig) -> Self { Self { otlp_config: Some(config), ..self } } fn construct_opentelemetry_tracer(&self) -> Result<Option<trace::Tracer>> { let trace_config = { let sampler = match self.traces_sampler { TracesSampler::AlwaysOn => trace::Sampler::AlwaysOn, TracesSampler::AlwaysOff => { return Ok(None); } TracesSampler::TraceIdRatio => { trace::Sampler::TraceIdRatioBased(self.traces_sampler_arg) } TracesSampler::ParentBasedAlwaysOn => { trace::Sampler::ParentBased(Box::new(trace::Sampler::AlwaysOn)) } TracesSampler::ParentBasedAlwaysOff => { trace::Sampler::ParentBased(Box::new(trace::Sampler::AlwaysOff)) } TracesSampler::ParentBasedTraceIdRatio => trace::Sampler::ParentBased(Box::new( trace::Sampler::TraceIdRatioBased(self.traces_sampler_arg), )), }; let resource = Resource::new(vec![KeyValue::new("service.name", "influxdb-iox")]); trace::Config::default() .with_sampler(sampler) .with_resource(resource) }; Ok(match self.traces_exporter { TracesExporter::Jaeger => { let config = self .jaeger_config .as_ref() .ok_or(Error::JaegerConfigMissing)?; let agent_endpoint = format!("{}:{}", config.agent_host.trim(), config.agent_port); opentelemetry::global::set_text_map_propagator( opentelemetry_jaeger::Propagator::new(), ); Some({ let builder = opentelemetry_jaeger::new_pipeline() .with_trace_config(trace_config) .with_agent_endpoint(agent_endpoint) .with_service_name(&config.service_name) .with_max_packet_size(config.max_packet_size); // Batching is hard to tune because the max batch size // is not currently exposed as a tunable from the trace config, and even then // it's defined in terms of max number of spans, and not their size in bytes. // Thus we enable batching only when the MTU size is 65000 which is the value suggested // by jaeger when exporting to localhost. if config.max_packet_size >= 65_000 { builder.install_batch(opentelemetry::runtime::Tokio) } else { builder.install_simple() } .unwrap() }) } TracesExporter::Otlp => { let config = self.otlp_config.as_ref().ok_or(Error::OtlpConfigMissing)?; let jaeger_endpoint = format!("{}:{}", config.host.trim(), config.port); Some( opentelemetry_otlp::new_pipeline() .with_trace_config(trace_config) .with_endpoint(jaeger_endpoint) .with_protocol(opentelemetry_otlp::Protocol::Grpc) .with_tonic() .install_batch(opentelemetry::runtime::Tokio) .unwrap(), ) } TracesExporter::None => None, }) } pub fn build(self) -> Result<impl Subscriber> { let (traces_layer_filter, traces_layer_otel) = match self.construct_opentelemetry_tracer()? { None => (None, None), Some(tracer) => ( self.traces_filter, Some(tracing_opentelemetry::OpenTelemetryLayer::new(tracer)), ), }; let log_writer = self.make_writer; let log_format = self.log_format; let with_target = self.with_target; let with_ansi = self.with_ansi; let (log_format_full, log_format_pretty, log_format_json, log_format_logfmt) = match log_format { LogFormat::Full => ( Some( fmt::layer() .with_writer(log_writer) .with_target(with_target) .with_ansi(with_ansi), ), None, None, None, ), LogFormat::Pretty => ( None, Some( fmt::layer() .pretty() .with_writer(log_writer) .with_target(with_target) .with_ansi(with_ansi), ), None, None, ), LogFormat::Json => ( None, None, Some( fmt::layer() .json() .with_writer(log_writer) .with_target(with_target) .with_ansi(with_ansi), ), None, ), LogFormat::Logfmt => ( None, None, None, Some(logfmt::LogFmtLayer::new(log_writer).with_target(with_target)), ), }; let subscriber = tracing_subscriber::Registry::default() .with(self.log_filter.unwrap_or(self.default_log_filter)) .with(log_format_full) .with(log_format_pretty) .with(log_format_json) .with(log_format_logfmt) .with(traces_layer_otel) .with(traces_layer_filter); Ok(subscriber) } /// Build a tracing subscriber and install it as a global default subscriber for all threads. /// /// It returns a RAII guard that will ensure all events are flushed to the tracing exporter. pub fn install_global(self) -> Result<TracingGuard> { let subscriber = self.build()?; tracing::subscriber::set_global_default(subscriber)?; Ok(TracingGuard) } } /// A RAII guard. On Drop, tracing and OpenTelemetry are flushed and shut down. #[derive(Debug)] pub struct TracingGuard; impl Drop for TracingGuard { fn drop(&mut self) { opentelemetry::global::shutdown_tracer_provider(); } } #[cfg(test)] pub mod test_util { ///! Utilities for testing logging and tracing. use super::*; use observability_deps::tracing::{self, debug, error, info, trace, warn}; use observability_deps::tracing_subscriber::fmt::MakeWriter; use std::sync::{Arc, Mutex}; use synchronized_writer::SynchronizedWriter; /// Log writer suitable for using in tests. /// It captures log output in a buffer and provides ways to filter out /// non-deterministic parts such as timestamps. #[derive(Default, Debug, Clone)] pub struct TestWriter { buffer: Arc<Mutex<Vec<u8>>>, } impl TestWriter { /// Return a writer and reference to the to-be captured output. pub fn new() -> (Self, Captured) { let writer = Self::default(); let captured = Captured(Arc::clone(&writer.buffer)); (writer, captured) } } impl MakeWriter for TestWriter { type Writer = SynchronizedWriter<Vec<u8>>; fn make_writer(&self) -> Self::Writer { SynchronizedWriter::new(Arc::clone(&self.buffer)) } } #[derive(Debug)] pub struct Captured(Arc<Mutex<Vec<u8>>>); impl Captured { /// Removes non-determinism by removing timestamps from the log lines. /// It supports the built-in tracing timestamp format and the logfmt timestamps. pub fn without_timestamps(&self) -> String { // logfmt or fmt::layer() time format let timestamp = regex::Regex::new( r"(?m)( ?time=[0-9]+|^([A-Z][a-z]{2}) \d{1,2} \d{2}:\d{2}:\d{2}.\d{3} *)", ) .unwrap(); timestamp.replace_all(&self.to_string(), "").to_string() } } impl std::fmt::Display for Captured { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let bytes = self.0.lock().unwrap(); write!(f, "{}", std::str::from_utf8(&bytes).unwrap()) } } /// This is a test helper that sets a few test-friendly parameters /// such as disabled ANSI escape sequences on the provided builder. /// This helper then emits a few logs of different verbosity levels /// and returns the captured output. pub fn simple_test<W>(builder: Builder<W>) -> Captured where W: MakeWriter + Send + Sync + 'static, { let (writer, output) = TestWriter::new(); let subscriber = builder .with_writer(writer) .with_target(false) .with_ansi(false) .build() .expect("subscriber"); tracing::subscriber::with_default(subscriber, || { error!("foo"); warn!("woo"); info!("bar"); debug!("baz"); trace!("trax"); }); output } } #[cfg(test)] mod tests { use super::*; use crate::test_util::*; #[test] fn simple_logging() { assert_eq!( simple_test(Builder::new()).without_timestamps(), r#" ERROR foo WARN woo "# .trim_start(), ); } #[test] fn simple_logging_logfmt() { assert_eq!( simple_test(Builder::new().with_log_format(LogFormat::Logfmt)).without_timestamps(), r#" level=error msg=foo level=warn msg=woo "# .trim_start(), ); } #[test] fn verbose_count() { assert_eq!( simple_test(Builder::new().with_log_verbose_count(0)).without_timestamps(), r#" ERROR foo WARN woo "# .trim_start(), ); assert_eq!( simple_test(Builder::new().with_log_verbose_count(1)).without_timestamps(), r#" ERROR foo WARN woo INFO bar "# .trim_start(), ); assert_eq!( simple_test(Builder::new().with_log_verbose_count(2)).without_timestamps(), r#" ERROR foo WARN woo INFO bar DEBUG baz "# .trim_start(), ); assert_eq!( simple_test(Builder::new().with_log_verbose_count(3)).without_timestamps(), r#" ERROR foo WARN woo INFO bar DEBUG baz TRACE trax "# .trim_start(), ); } #[test] fn test_override_default_log_filter() { const DEFAULT_LOG_FILTER: &str = "error"; assert_eq!( simple_test( Builder::new() .with_default_log_filter(DEFAULT_LOG_FILTER) .with_log_verbose_count(0) ) .without_timestamps(), r#" ERROR foo "# .trim_start(), ); assert_eq!( simple_test( Builder::new() .with_default_log_filter(DEFAULT_LOG_FILTER) .with_log_verbose_count(1) ) .without_timestamps(), r#" ERROR foo WARN woo INFO bar "# .trim_start(), ); } }
use super::tunbuilder; use super::Tunnel; use super::{Request, TunStub}; use crate::config::{TunCfg, KEEP_ALIVE_INTERVAL}; use crate::service::{Instruction, SubServiceCtlCmd, TxType}; use bytes::BytesMut; use failure::Error; use fnv::FnvHashSet as HashSet; use futures_03::prelude::*; use log::{debug, error, info}; use std::cell::RefCell; use std::net::IpAddr; use std::net::SocketAddr; use std::rc::Rc; use std::result::Result; use std::time::Duration; use stream_cancel::{Trigger, Tripwire}; use tokio::sync::mpsc::UnboundedSender; type TunnelItem = Option<Rc<RefCell<Tunnel>>>; type LongLive = Rc<RefCell<TunMgr>>; pub struct TunMgr { pub relay_domain: String, pub relay_port: u16, pub url: String, capacity: usize, pub tunnel_req_cap: usize, pub request_quota: u16, dns_server: String, tunnels: Vec<TunnelItem>, sorted_tun_indies: Vec<u16>, current_tun_idx: u16, reconnect_queue: Vec<u16>, discarded: bool, keepalive_trigger: Option<Trigger>, pub token: String, service_tx: TxType, udpx_tx: Option<UnboundedSender<SubServiceCtlCmd>>, access_log: HashSet<(std::net::IpAddr, std::net::IpAddr)>, } impl TunMgr { pub fn new(service_tx: TxType, tunnel_count: usize, cfg: &TunCfg) -> LongLive { info!("[TunMgr]new TunMgr"); let capacity = tunnel_count; let mut vec = Vec::with_capacity(capacity); let mut sv = Vec::with_capacity(capacity); for n in 0..capacity { vec.push(None); sv.push(n as u16); } let dns_server = cfg.default_dns_server.to_string(); let token = cfg.token.to_string(); Rc::new(RefCell::new(TunMgr { url: cfg.tunnel_url.to_string(), capacity: capacity, tunnel_req_cap: cfg.tunnel_req_cap, tunnels: vec, reconnect_queue: Vec::with_capacity(capacity), relay_domain: cfg.relay_domain.to_string(), relay_port: cfg.relay_port, discarded: false, keepalive_trigger: None, sorted_tun_indies: sv, current_tun_idx: 0, request_quota: cfg.request_quota as u16, token, service_tx: service_tx, udpx_tx: None, dns_server, access_log: HashSet::default(), })) } pub fn init(&mut self, s: LongLive) -> Result<(), Error> { info!("[TunMgr]init"); for n in 0..self.capacity { let index = n; let mgr = s.clone(); tunbuilder::connect(self, mgr, index, self.dns_server.to_string()); } self.start_keepalive_timer(s); Ok(()) } pub fn update_tuncfg(&mut self, cfg: &TunCfg) { self.url = cfg.tunnel_url.to_string(); self.relay_domain = cfg.relay_domain.to_string(); self.relay_port = cfg.relay_port; self.request_quota = cfg.request_quota as u16; } pub fn on_tunnel_created(&mut self, tun: Rc<RefCell<Tunnel>>) -> std::result::Result<(), ()> { info!("[TunMgr]on_tunnel_created"); if self.discarded != false { error!("[TunMgr]on_tunnel_created, tunmgr is discarded, tun will be discarded"); return Err(()); } let index = tun.borrow().index; let tunnels = &mut self.tunnels; let t = &tunnels[index]; if t.is_some() { panic!("[TunMgr]there is tunnel at {} already!", index); } tunnels[index] = Some(tun.clone()); if self.udpx_tx.is_some() { tun.borrow_mut() .set_udpx_tx(self.udpx_tx.as_ref().unwrap().clone()); } info!("[TunMgr]tunnel created, index:{}", index); Ok(()) } pub fn on_tunnel_closed(&mut self, index: usize) { info!("[TunMgr]on_tunnel_closed"); let t = self.on_tunnel_closed_interal(index); match t { Some(t) => { let mut t = t.borrow_mut(); t.on_closed(); if self.discarded { info!("[TunMgr]on_tunnel_closed, tunmgr is discarded, tun will be discard"); return; } else { self.reconnect_queue.push(index as u16); } info!("[TunMgr]tunnel closed, index:{}", index); } None => {} } } pub fn on_tunnel_build_error(&mut self, index: usize) { info!("[TunMgr]on_tunnel_build_error"); if self.discarded != false { error!("[TunMgr]on_tunnel_build_error, tunmgr is discarded, tun will be not reconnect"); return; } self.reconnect_queue.push(index as u16); info!("[TunMgr]tunnel build error, index:{}, rebuild later", index); } fn on_tunnel_closed_interal(&mut self, index: usize) -> TunnelItem { info!("[TunMgr]on_tunnel_closed_interal"); let tunnels = &mut self.tunnels; let t = &tunnels[index]; match t { Some(t) => { let t = t.clone(); tunnels[index] = None; Some(t) } None => None, } } fn get_tunnel(&self, index: usize) -> TunnelItem { // info!("[TunMgr]get_tunnel"); let tunnels = &self.tunnels; let tun = &tunnels[index]; match tun { Some(tun) => Some(tun.clone()), None => None, } } pub fn on_request_created(&mut self, req: Request, ip: IpAddr, port: u16) -> Option<TunStub> { info!("[TunMgr]on_request_created"); if self.discarded != false { error!("[TunMgr]on_request_created, tunmgr is discarded, request will be discarded"); return None; } if let Some(tun) = self.alloc_tunnel_for_req() { let mut tun = tun.borrow_mut(); tun.on_request_created(req, ip, port) } else { None } } pub fn on_request_closed(&mut self, tunstub: &TunStub) { info!("[TunMgr]on_request_closed:{:?}", tunstub); let tidx = tunstub.tun_idx; match self.get_tunnel(tidx as usize) { Some(tun) => { let mut tun = tun.borrow_mut(); tun.on_request_closed(tunstub); } None => { error!("[TunMgr]on_request_closed:{:?}, not found", tunstub); } } } fn alloc_tunnel_for_req(&mut self) -> TunnelItem { info!("[TunMgr]alloc_tunnel_for_req"); let length = self.sorted_tun_indies.len(); let current_idx = self.current_tun_idx as usize; for n in current_idx..length { let tun_idx = self.sorted_tun_indies[n]; let tun2 = &self.tunnels[tun_idx as usize]; if tun2.is_none() { continue; } let tun2 = tun2.as_ref().unwrap(); let tun = tun2.borrow(); let req_count_tun = tun.get_req_count(); // skip fulled tunnel if (req_count_tun + 1) >= tun.capacity { continue; } self.current_tun_idx = ((n + 1) % length) as u16; return Some(tun2.clone()); } for n in 0..current_idx { let tun_idx = self.sorted_tun_indies[n]; let tun2 = &self.tunnels[tun_idx as usize]; if tun2.is_none() { continue; } let tun2 = tun2.as_ref().unwrap(); let tun = tun2.borrow(); let req_count_tun = tun.get_req_count(); // skip fulled tunnel if (req_count_tun + 1) >= tun.capacity { continue; } self.current_tun_idx = ((n + 1) % length) as u16; return Some(tun2.clone()); } return None; } fn sort_tunnels_by_busy(&mut self) { let tunnels = &self.tunnels; self.sorted_tun_indies.sort_by(|x, y| { let tun1 = &tunnels[*x as usize]; let tun2 = &tunnels[*y as usize]; if tun1.is_none() || tun2.is_none() { return std::cmp::Ordering::Equal; } let tun1 = tun1.as_ref().unwrap().borrow(); let tun2 = tun2.as_ref().unwrap().borrow(); let busy1 = tun1.get_busy(); let busy2 = tun2.get_busy(); busy1.cmp(&busy2) }); let tunnels = &self.tunnels; for t in tunnels.iter() { match t { Some(tun) => { let mut tun = tun.borrow_mut(); tun.reset_busy(); } None => {} } } } fn send_pings(&self) { let tunnels = &self.tunnels; for t in tunnels.iter() { match t { Some(tun) => { let mut tun = tun.borrow_mut(); if !tun.send_ping() { tun.close_rawfd(); } } None => {} } } } fn process_reconnect(&mut self, s: LongLive) { loop { if let Some(index) = self.reconnect_queue.pop() { info!("[TunMgr]process_reconnect, index:{}", index); tunbuilder::connect(self, s.clone(), index as usize, self.dns_server.to_string()); } else { break; } } } fn save_keepalive_trigger(&mut self, trigger: Trigger) { self.keepalive_trigger = Some(trigger); } fn keepalive(&mut self, s: LongLive) { if self.discarded != false { error!("[TunMgr]keepalive, tunmgr is discarded, not do keepalive"); return; } self.sort_tunnels_by_busy(); self.send_pings(); self.process_reconnect(s.clone()); // access report self.report_access_log(); } pub fn stop(&mut self) { if self.discarded != false { error!("[TunMgr]stop, tunmgr is already discarded"); return; } self.discarded = true; self.keepalive_trigger = None; // close all tunnel, and forbit reconnect let tunnels = &self.tunnels; for t in tunnels.iter() { match t { Some(tun) => { let tun = tun.borrow(); tun.close_rawfd(); } None => {} } } } fn start_keepalive_timer(&mut self, s2: LongLive) { info!("[TunMgr]start_keepalive_timer"); let (trigger, tripwire) = Tripwire::new(); self.save_keepalive_trigger(trigger); // tokio timer, every 3 seconds let task = tokio::time::interval(Duration::from_millis(KEEP_ALIVE_INTERVAL)) .skip(1) .take_until(tripwire) .for_each(move |instant| { debug!("[TunMgr]keepalive timer fire; instant={:?}", instant); let mut rf = s2.borrow_mut(); rf.keepalive(s2.clone()); future::ready(()) }); let t_fut = async move { task.await; info!("[TunMgr] keepalive timer future completed"); () }; tokio::task::spawn_local(t_fut); } pub fn log_access(&mut self, peer_addr: std::net::IpAddr, target_ip: std::net::IpAddr) { // send to service self.access_log.insert((peer_addr, target_ip)); } fn report_access_log(&mut self) { if self.access_log.len() < 1 { return; } let mut v = Vec::with_capacity(self.access_log.len()); for k in self.access_log.drain() { v.push(k); } if let Err(e) = self.service_tx.send(Instruction::AccessLog(v)) { error!("[TunMgr]report_access_log unbounded_send failed:{}", e); } } pub fn udp_proxy_north( &mut self, msg: BytesMut, src_addr: SocketAddr, dst_addr: SocketAddr, hash_code: usize, ) { // select a tunnel, forward udp msg to dv via that tunnnel let tun_idx = hash_code % self.tunnels.len(); match self.tunnels.get(tun_idx) { Some(tun_some) => match tun_some { Some(tun) => { let tun = tun.borrow(); tun.udp_proxy_north(msg, src_addr, dst_addr); self.access_log.insert((src_addr.ip(), dst_addr.ip())); } None => { error!("[TunMgr]udp_proxy_north, no tunnel found at:{}", tun_idx); } }, None => {} } } pub fn set_udpx_tx(&mut self, tx: UnboundedSender<SubServiceCtlCmd>) { self.udpx_tx = Some(tx.clone()); let tunnels = &self.tunnels; for t in tunnels.iter() { match t { Some(tun) => { let mut tun = tun.borrow_mut(); tun.set_udpx_tx(tx.clone()); } None => {} } } } }
mod face; pub mod corners; pub mod edges; use cube::face::Face; use cube::corners::Corners; use cube::corners::Corner; use cube::edges::Edges; use cube::edges::Edge; use move_::Move; use move_::UserMove; #[derive(Eq, PartialEq)] pub struct Cube { corners: Corners, edges: Edges, } impl Cube { pub fn from_shuffle_sequence<I>(shuffle_sequence: I) -> Self where I: IntoIterator<Item=(UserMove, usize)> { let mut new = Self { corners: Corners::new(), edges: Edges::new(), }; for m in shuffle_sequence.into_iter() { let mprime = m.1; for _ in 0..mprime { new.apply_move(m.0.to_move()); } } new } pub fn new_default() -> Self { Self::default() } pub fn is_solved(&self) -> bool { *self == Self::default() } pub fn corners_multiply(&mut self, m: Move) { self.corners.multiply(m); } pub fn edges_multiply(&mut self, m: Move) { self.edges.multiply(m); } pub fn multiply(&mut self, m: Move) { self.corners.multiply(m); self.edges.multiply(m); } pub fn twist(&self) -> u32 { let mut ret: u32 = 0; for x in usize::from(Corner::URF)..usize::from(Corner::DRB) { ret = 3 * ret + self.corners.orientations[x] as u32; } ret } pub fn set_twist(&mut self, twist: i16) { let mut twist = twist; let mut parity: u32 = 0; for x in (usize::from(Corner::URF)..usize::from(Corner::DRB)).rev() { self.corners.orientations[x] = (twist % 3) as u8; parity += self.corners.orientations[x] as u32; twist /= 3; } self.corners.orientations[usize::from(Corner::DRB)] = (3 - parity as u8 % 3) % 3; } pub fn flip(&self) -> u32 { let mut ret: u32 = 0; for x in usize::from(Edge::UR)..usize::from(Edge::BR) { ret = 2 * ret + self.edges.orientations[x] as u32; } ret } pub fn set_flip(&mut self, flip: i16) { let mut flip = flip; let mut parity: u32 = 0; for x in (usize::from(Edge::UR)..usize::from(Edge::BR)).rev() { self.edges.orientations[x] = (flip % 2) as u8; parity += self.edges.orientations[x] as u32; flip /= 2; } self.edges.orientations[usize::from(Edge::BR)] = (2 - parity as u8 % 2) % 2; } pub fn corner_parity(&self) -> u32 { let mut ret: u32 = 0; for x in (usize::from(Corner::URF) + 1..=usize::from(Corner::DRB)).rev() { for y in (usize::from(Corner::URF)..x).rev() { if usize::from(self.corners.permutations[y]) > usize::from(self.corners.permutations[x]) { ret += 1; } } } ret % 2 } pub fn fr_to_br(&self) -> u32 { let mut a: u32 = 0; let mut x: u32 = 0; let mut edges: [Edge; 4] = [Edge::UR; 4]; for i in (usize::from(Edge::UR)..=usize::from(Edge::BR)).rev() { if usize::from(Edge::FR) <= usize::from(self.edges.permutations[i]) && usize::from(self.edges.permutations[i]) <= usize::from(Edge::BR) { a += cnk(11 - i as i16, (x + 1) as i16) as u32; edges[3 - x as usize] = self.edges.permutations[i]; x += 1; } } let mut b: u32 = 0; for i in (1..=3).rev() { let mut k: u32 = 0; loop { if usize::from(edges[i]) == i + 8 { break; } Edge::rotate_edges_slice(&mut edges, 0, i, false); k += 1; } b = (i as u32 + 1) * b + k; } 24 * a + b } pub fn set_fr_to_br(&mut self, index: i16) { let mut a = index / 24; let mut b = index % 24; let mut edges: [Edge; 4] = [Edge::FR, Edge::FL, Edge::BL, Edge::BR]; let others: [Edge; 8] = [Edge::UR, Edge::UF, Edge::UL, Edge::UB, Edge::DR, Edge::DF, Edge::DL, Edge::DB]; self.edges.permutations = [Edge::DB; 12]; for x in 1..=3 { let mut k = b % (x + 1); b /= x + 1; loop { if k == 0 { break; } Edge::rotate_edges_slice(&mut edges, 0, x as usize, true); k -= 1; } } let mut z: i16 = 3; for x in usize::from(Edge::UR)..=usize::from(Edge::BR) { if a - cnk(11 - x as i16, z + 1) >= 0 { self.edges.permutations[x] = edges[3 - z as usize]; a -= cnk(11 - x as i16, z + 1); z -= 1; } } z = 0; for x in usize::from(Edge::UR)..=usize::from(Edge::BR) { if self.edges.permutations[x] == Edge::DB { self.edges.permutations[x] = others[z as usize]; z += 1; } } } pub fn urf_to_dlf(&self) -> u32 { let mut a: u32 = 0; let mut x: u32 = 0; let mut corners: [Corner; 6] = [Corner::DBL; 6]; for i in usize::from(Corner::URF)..=usize::from(Corner::DRB) { if usize::from(self.corners.permutations[i]) <= usize::from(Corner::DLF) { a += cnk(i as i16, (x + 1) as i16) as u32; corners[x as usize] = self.corners.permutations[i]; x += 1; } } let mut b: u32 = 0; for i in (1..=5).rev() { let mut k: u32 = 0; loop { if usize::from(corners[i]) == i { break; } Corner::rotate_corners_slice(&mut corners, 0, i, false); k += 1; } b = (i as u32 + 1) * b + k; } 720 * a + b } pub fn set_urf_to_dlf(&mut self, index: i16) { let mut a = index / 720; let mut b = index % 720; let mut corners: [Corner; 6] = [Corner::URF, Corner::UFL, Corner::ULB, Corner::UBR, Corner::DFR, Corner::DLF]; let others: [Corner; 2] = [Corner::DBL, Corner::DRB]; self.corners.permutations = [Corner::DRB; 8]; for x in 1..6 { let mut k = b % (x + 1); b /= x + 1; loop { if k == 0 { break; } Corner::rotate_corners_slice(&mut corners, 0, x as usize, true); k -= 1; } } let mut z: i16 = 5; for x in (usize::from(Corner::URF)..=usize::from(Corner::DRB)).rev() { if a - cnk(x as i16, z + 1) >= 0 { self.corners.permutations[x] = corners[z as usize]; a -= cnk(x as i16, z + 1); z -= 1; } } z = 0; for x in usize::from(Corner::URF)..=usize::from(Corner::DRB) { if self.corners.permutations[x] == Corner::DRB { self.corners.permutations[x] = others[z as usize]; z += 1; } } } pub fn ur_to_ul(&self) -> u32 { let mut a: u32 = 0; let mut x: u32 = 0; let mut edges: [Edge; 3] = [Edge::UR; 3]; for i in usize::from(Edge::UR)..=usize::from(Edge::BR) { if usize::from(self.edges.permutations[i]) <= usize::from(Edge::UL) { a += cnk(i as i16, (x + 1) as i16) as u32; edges[x as usize] = self.edges.permutations[i]; x += 1; } } let mut b: u32 = 0; for i in (1..=2).rev() { let mut k: u32 = 0; loop { if usize::from(edges[i]) == i { break; } Edge::rotate_edges_slice(&mut edges, 0, i, false); k += 1; } b = (i as u32 + 1) * b + k; } 6 * a + b } pub fn set_ur_to_ul(&mut self, index: i16) { let mut a = index / 6; let mut b = index % 6; let mut edges: [Edge; 3] = [Edge::UR, Edge::UF, Edge::UL]; self.edges.permutations = [Edge::BR; 12]; for x in 1..=2 { let mut k: i16 = b % (x + 1); b /= x + 1; loop { if k == 0 { break; } Edge::rotate_edges_slice(&mut edges, 0, x as usize, true); k -= 1; } } let mut z: i16 = 2; for x in (usize::from(Edge::UR)..=usize::from(Edge::BR)).rev() { if a - cnk(x as i16, z + 1) >= 0 { self.edges.permutations[x] = edges[z as usize]; a -= cnk(x as i16, z + 1); z -=1; } } } pub fn ub_to_df(&self) -> u32 { let mut a: u32 = 0; let mut x: i16 = 0; let mut edges: [Edge; 3] = [Edge::UR; 3]; for i in usize::from(Edge::UR)..=usize::from(Edge::BR) { if usize::from(Edge::UB) <= usize::from(self.edges.permutations[i]) && usize::from(self.edges.permutations[i]) <= usize::from(Edge::DF) { a += cnk(i as i16, x + 1) as u32; edges[x as usize] = self.edges.permutations[i]; x += 1; } } let mut b: u32 = 0; for i in (1..=2).rev() { let mut k: u32 = 0; loop { if usize::from(edges[i]) == usize::from(Edge::UB) + i { break; } Edge::rotate_edges_slice(&mut edges, 0, i, false); k += 1; } b = (i as u32 + 1) * b + k; } 6 * a + b } pub fn set_ub_to_df(&mut self, index: i16) { let mut a = index / 6; let mut b = index % 6; let mut edges: [Edge; 3] = [Edge::UB, Edge::DR, Edge::DF]; self.edges.permutations = [Edge::BR; 12]; for x in 1..=2 { let mut k: i16 = b % (x + 1); b /= x + 1; loop { if k == 0 { break; } Edge::rotate_edges_slice(&mut edges, 0, x as usize, true); k -= 1; } } let mut z: i16 = 2; for x in (usize::from(Edge::UR)..=usize::from(Edge::BR)).rev() { if a - cnk(x as i16, z + 1) >= 0 { self.edges.permutations[x] = edges[z as usize]; a -= cnk(x as i16, z + 1); z -=1; } } } pub fn ur_to_df(&self) -> u32 { let mut a: u32 = 0; let mut x: i16 = 0; let mut edges: [Edge; 6] = [Edge::UR; 6]; for i in usize::from(Edge::UR)..=usize::from(Edge::BR) { if usize::from(self.edges.permutations[i]) <= usize::from(Edge::DF) { a += cnk(i as i16, x + 1) as u32; edges[x as usize] = self.edges.permutations[i]; x += 1; } } let mut b: u32 = 0; for i in (1..=5).rev() { let mut k: u32 = 0; loop { if usize::from(edges[i]) == i { break; } Edge::rotate_edges_slice(&mut edges, 0, i, false); k += 1; } b = (i as u32 + 1) * b + k; } 720 * a + b } pub fn set_ur_to_df(&mut self, index: i16) { let mut a = index / 720; let mut b = index % 720; let mut edges: [Edge; 6] = [Edge::UR, Edge::UF, Edge::UL, Edge::UB, Edge::DR, Edge::DF]; let others: [Edge; 6] = [Edge::DL, Edge::DB, Edge::FR, Edge::FL, Edge::BL, Edge::BR]; self.edges.permutations = [Edge::BR; 12]; for x in 1..6 { let mut k = b % (x + 1); b /= x + 1; loop { if k == 0 { break; } Edge::rotate_edges_slice(&mut edges, 0, x as usize, true); k -= 1; } } let mut z: i16 = 5; for x in (usize::from(Edge::UR)..=usize::from(Edge::BR)).rev() { if a - cnk(x as i16, z + 1) >= 0 { self.edges.permutations[x] = edges[z as usize]; a -= cnk(x as i16, z + 1); z -= 1; } } z = 0; for x in usize::from(Edge::UR)..=usize::from(Edge::BR) { if self.edges.permutations[x] == Edge::BR { self.edges.permutations[x] = others[z as usize]; z += 1; } } } pub fn ur_to_uf_standalone(index1: i16, index2: i16) -> i16 { let mut a: Cube = Cube::new_default(); let mut b: Cube = Cube::new_default(); a.set_ur_to_ul(index1); b.set_ub_to_df(index2); for x in 0..8 { if a.edges.permutations[x] != Edge::BR { if b.edges.permutations[x] != Edge::BR { return -1 } else { b.edges.permutations[x] = a.edges.permutations[x]; } } } b.ur_to_df() as i16 } pub fn apply_move(&mut self, m: Move) { use move_::Move::*; match m { Move::Front => self.multiply(Front), Move::Right => self.multiply(Right), Move::Up => self.multiply(Up), Move::Back => self.multiply(Back), Move::Left => self.multiply(Left), Move::Down => self.multiply(Down), } } fn face(&self, face: Face) -> [Face; 9] { use self::corners::Corner::*; let corners = match face { Face::F => [UFL, URF, DFR, DLF], Face::B => [UBR, ULB, DBL, DRB], Face::U => [ULB, UBR, URF, UFL], Face::D => [DLF, DFR, DRB, DBL], Face::L => [ULB, UFL, DLF, DBL], Face::R => [URF, UBR, DRB, DFR], }; let mut corner_faces: [self::Face; 4] = [self::Face::F; 4]; for (i, c) in (&corners).iter().enumerate() { let corner_cubie: corners::Corner = self.corners.permutations[usize::from(*c)]; corner_faces[i] = corner_cubie.face(*c, self.corners.orientations[usize::from(*c)], face); } use self::edges::Edge::*; let edges = match face { Face::F => [UF, FR, DF, FL], Face::B => [UB, BL, DB, BR], Face::U => [UB, UR, UF, UL], Face::D => [DF, DR, DB, DL], Face::L => [UL, FL, DL, BL], Face::R => [UR, BR, DR, FR], }; let mut edge_faces: [self::Face; 4] = [self::Face::F; 4]; for (i, e) in (&edges).iter().enumerate() { let edge_cubie: edges::Edge = self.edges.permutations[usize::from(*e)]; edge_faces[i] = edge_cubie.face(*e, self.edges.orientations[usize::from(*e)], face); } [corner_faces[0], edge_faces[0], corner_faces[1], edge_faces[3], face, edge_faces[1], corner_faces[3], edge_faces[2], corner_faces[2]] } pub fn print(&self) { let faces = [ self.face(self::Face::U), self.face(self::Face::L), self.face(self::Face::F), self.face(self::Face::R), self.face(self::Face::B), self.face(self::Face::D), ]; print!("\n "); for i in 0..9 { print!("{} {} \x1b[0m", faces[0][i].color(), faces[0][i].to_string()); if i > 0 && (i+1) % 3 == 0 { print!("\n "); } } print!("\r\n"); for y in 0..3 { for &face in &faces { if face[4] != self::Face::U && face[4] != self::Face::D { for x in 0..3 { print!("{} {} \x1b[0m", face[x+y*3].color(), face[x+y*3].to_string()); } print!(" "); } } println!(); } print!("\n "); for i in 0..9 { print!("{} {} \x1b[0m", faces[5][i].color(), faces[5][i].to_string()); if i > 0 && (i+1) % 3 == 0 { print!("\n "); } } println!(); } } impl Default for Cube { fn default() -> Self { Self { corners: corners::Corners::default(), edges: edges::Edges::default(), } } } /// Binomial coefficient [n choose k]. pub fn cnk(n: i16, mut k: i16) -> i16 { if n < k { return 0; } if k > n / 2 { k = n - k; } let mut i: i16 = n; let mut j: i16 = 1; let mut s: i16 = 1; while i != n - k { s *= i; s /= j; j += 1; i -= 1; } s }
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_operation_batch_associate_scram_secret( input: &crate::input::BatchAssociateScramSecretInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_batch_associate_scram_secret_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_batch_disassociate_scram_secret( input: &crate::input::BatchDisassociateScramSecretInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_batch_disassociate_scram_secret_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_create_cluster( input: &crate::input::CreateClusterInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_create_cluster_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_create_configuration( input: &crate::input::CreateConfigurationInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_create_configuration_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_reboot_broker( input: &crate::input::RebootBrokerInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_reboot_broker_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_tag_resource( input: &crate::input::TagResourceInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_tag_resource_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_update_broker_count( input: &crate::input::UpdateBrokerCountInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_update_broker_count_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_update_broker_storage( input: &crate::input::UpdateBrokerStorageInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_update_broker_storage_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_update_broker_type( input: &crate::input::UpdateBrokerTypeInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_update_broker_type_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_update_cluster_configuration( input: &crate::input::UpdateClusterConfigurationInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_update_cluster_configuration_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_update_cluster_kafka_version( input: &crate::input::UpdateClusterKafkaVersionInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_update_cluster_kafka_version_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_update_configuration( input: &crate::input::UpdateConfigurationInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_update_configuration_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_update_monitoring( input: &crate::input::UpdateMonitoringInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_update_monitoring_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) }
//! Defines the CPU target. #![deny(bare_trait_objects, unused_lifetimes)] #![warn(clippy::all)] mod compile; mod context; mod cpu; mod cpu_argument; mod printer; pub use crate::context::Context; pub use crate::cpu::Cpu; use fxhash::FxHashMap; use telamon::{codegen, ir}; #[derive(Default)] pub(crate) struct NameGenerator { num_var: FxHashMap<ir::Type, usize>, num_glob_ptr: usize, } impl NameGenerator { /// Generate a variable name prefix from a type. fn gen_prefix(t: ir::Type) -> &'static str { match t { ir::Type::I(1) => "p", ir::Type::I(8) => "c", ir::Type::I(16) => "s", ir::Type::I(32) => "r", ir::Type::I(64) => "rd", ir::Type::F(16) => "h", ir::Type::F(32) => "f", ir::Type::F(64) => "d", ir::Type::PtrTo(..) => "ptr", _ => panic!("invalid CPU type"), } } } impl codegen::NameGenerator for NameGenerator { fn name(&mut self, t: ir::Type) -> String { let prefix = NameGenerator::gen_prefix(t); match t { ir::Type::PtrTo(..) => { let name = format!("{}{}", prefix, self.num_glob_ptr); self.num_glob_ptr += 1; name } _ => { let entry = self.num_var.entry(t).or_insert(0); let name = format!("{}{}", prefix, *entry); *entry += 1; name } } } }
use crate::assets::sprite::SamplerDef; use serde_derive::{Deserialize, Serialize}; use std::collections::HashMap; #[cfg(feature = "packed")] use crate::assets::sprite::SpriteSyncLoader; #[derive(Serialize, Deserialize)] pub struct PackedSpriteAsset { pub w: u32, pub h: u32, pub data: Vec<u8>, pub sampler: SamplerDef, } #[derive(Serialize, Deserialize)] pub struct Packed { pub content: HashMap<String, PackedSpriteAsset>, } #[cfg(feature = "packed")] const SPRITES: &[u8] = include_bytes!("../../../packed.bin"); #[cfg(feature = "packed")] pub struct SpritePackLoader { packed: Packed, fallback_loader: SpriteSyncLoader, } #[cfg(feature = "packed")] mod implementation { use super::*; use crate::assets::sprite::SpriteAsset; use crate::assets::{Asset, AssetError, Loader}; use luminance::context::GraphicsContext; use luminance::texture::{GenMipmaps, Texture}; use luminance_gl::GL33; use std::path::PathBuf; impl SpritePackLoader { pub fn new(base_path: PathBuf) -> Self { Self { packed: bincode::deserialize(SPRITES).unwrap(), fallback_loader: SpriteSyncLoader::new(base_path), } } } impl<S> Loader<S, SpriteAsset<S>, String> for SpritePackLoader where S: GraphicsContext<Backend = GL33>, { fn load(&mut self, asset_name: String) -> Asset<SpriteAsset<S>> { let mut asset = Asset::new(); if let Some(sprite) = self.packed.content.get(&asset_name) { asset.set_loaded(SpriteAsset::Loading( sprite.w, sprite.h, sprite.data.clone(), sprite.sampler.clone().to_sampler(), )) } else { return self.fallback_loader.load(asset_name); } asset } fn upload_to_gpu(&self, ctx: &mut S, inner: &mut SpriteAsset<S>) -> Result<(), AssetError> { let tex = if let SpriteAsset::Loading(w, h, data, sampler) = inner { let mut tex = Texture::new(ctx, [*w, *h], 0, sampler.clone())?; tex.upload_raw(GenMipmaps::No, data)?; tex } else { panic!("Expecting Loading variant.") }; *inner = SpriteAsset::Uploaded(tex); Ok(()) } } }
extern crate hlua; use hlua::Lua; use std::fs::File; use std::path::Path; #[test] #[should_panic] fn readerrors() { let mut lua = Lua::new(); let file = File::open(&Path::new("/path/to/unexisting/file")).unwrap(); let _res: () = lua.execute_from_reader(file).unwrap(); }
pub mod problem1; pub mod problem2;
#![allow(clippy::many_single_char_names)] use super::*; #[derive(Clone, PartialEq, Default)] pub struct GUID(pub u32, pub u16, pub u16, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8); impl GUID { pub fn from_args(args: &[(String, ConstantValue)]) -> Self { Self(args[0].1.unwrap_u32(), args[1].1.unwrap_u16(), args[2].1.unwrap_u16(), args[3].1.unwrap_u8(), args[4].1.unwrap_u8(), args[5].1.unwrap_u8(), args[6].1.unwrap_u8(), args[7].1.unwrap_u8(), args[8].1.unwrap_u8(), args[9].1.unwrap_u8(), args[10].1.unwrap_u8()) } pub fn from_attributes<I: IntoIterator<Item = Attribute>>(attributes: I) -> Option<Self> { for attribute in attributes { if attribute.name() == "GuidAttribute" { return Some(Self::from_args(&attribute.args())); } } None } } impl core::fmt::Debug for GUID { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{:08x?}-{:04x?}-{:04x?}-{:02x?}{:02x?}-{:02x?}{:02x?}{:02x?}{:02x?}{:02x?}{:02x?}", self.0, self.1, self.2, self.3, self.4, self.5, self.6, self.7, self.8, self.9, self.10,) } }
#[doc = "Reader of register TXTYPE7"] pub type R = crate::R<u8, super::TXTYPE7>; #[doc = "Writer for register TXTYPE7"] pub type W = crate::W<u8, super::TXTYPE7>; #[doc = "Register TXTYPE7 `reset()`'s with value 0"] impl crate::ResetValue for super::TXTYPE7 { type Type = u8; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `TEP`"] pub type TEP_R = crate::R<u8, u8>; #[doc = "Write proxy for field `TEP`"] pub struct TEP_W<'a> { w: &'a mut W, } impl<'a> TEP_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x0f) | ((value as u8) & 0x0f); self.w } } #[doc = "Protocol\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum PROTO_A { #[doc = "0: Control"] CTRL = 0, #[doc = "1: Isochronous"] ISOC = 1, #[doc = "2: Bulk"] BULK = 2, #[doc = "3: Interrupt"] INT = 3, } impl From<PROTO_A> for u8 { #[inline(always)] fn from(variant: PROTO_A) -> Self { variant as _ } } #[doc = "Reader of field `PROTO`"] pub type PROTO_R = crate::R<u8, PROTO_A>; impl PROTO_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> PROTO_A { match self.bits { 0 => PROTO_A::CTRL, 1 => PROTO_A::ISOC, 2 => PROTO_A::BULK, 3 => PROTO_A::INT, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `CTRL`"] #[inline(always)] pub fn is_ctrl(&self) -> bool { *self == PROTO_A::CTRL } #[doc = "Checks if the value of the field is `ISOC`"] #[inline(always)] pub fn is_isoc(&self) -> bool { *self == PROTO_A::ISOC } #[doc = "Checks if the value of the field is `BULK`"] #[inline(always)] pub fn is_bulk(&self) -> bool { *self == PROTO_A::BULK } #[doc = "Checks if the value of the field is `INT`"] #[inline(always)] pub fn is_int(&self) -> bool { *self == PROTO_A::INT } } #[doc = "Write proxy for field `PROTO`"] pub struct PROTO_W<'a> { w: &'a mut W, } impl<'a> PROTO_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PROTO_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "Control"] #[inline(always)] pub fn ctrl(self) -> &'a mut W { self.variant(PROTO_A::CTRL) } #[doc = "Isochronous"] #[inline(always)] pub fn isoc(self) -> &'a mut W { self.variant(PROTO_A::ISOC) } #[doc = "Bulk"] #[inline(always)] pub fn bulk(self) -> &'a mut W { self.variant(PROTO_A::BULK) } #[doc = "Interrupt"] #[inline(always)] pub fn int(self) -> &'a mut W { self.variant(PROTO_A::INT) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u8) & 0x03) << 4); self.w } } #[doc = "Operating Speed\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum SPEED_A { #[doc = "0: Default"] DFLT = 0, #[doc = "2: Full"] FULL = 2, #[doc = "3: Low"] LOW = 3, } impl From<SPEED_A> for u8 { #[inline(always)] fn from(variant: SPEED_A) -> Self { variant as _ } } #[doc = "Reader of field `SPEED`"] pub type SPEED_R = crate::R<u8, SPEED_A>; impl SPEED_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, SPEED_A> { use crate::Variant::*; match self.bits { 0 => Val(SPEED_A::DFLT), 2 => Val(SPEED_A::FULL), 3 => Val(SPEED_A::LOW), i => Res(i), } } #[doc = "Checks if the value of the field is `DFLT`"] #[inline(always)] pub fn is_dflt(&self) -> bool { *self == SPEED_A::DFLT } #[doc = "Checks if the value of the field is `FULL`"] #[inline(always)] pub fn is_full(&self) -> bool { *self == SPEED_A::FULL } #[doc = "Checks if the value of the field is `LOW`"] #[inline(always)] pub fn is_low(&self) -> bool { *self == SPEED_A::LOW } } #[doc = "Write proxy for field `SPEED`"] pub struct SPEED_W<'a> { w: &'a mut W, } impl<'a> SPEED_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: SPEED_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Default"] #[inline(always)] pub fn dflt(self) -> &'a mut W { self.variant(SPEED_A::DFLT) } #[doc = "Full"] #[inline(always)] pub fn full(self) -> &'a mut W { self.variant(SPEED_A::FULL) } #[doc = "Low"] #[inline(always)] pub fn low(self) -> &'a mut W { self.variant(SPEED_A::LOW) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u8) & 0x03) << 6); self.w } } impl R { #[doc = "Bits 0:3 - Target Endpoint Number"] #[inline(always)] pub fn tep(&self) -> TEP_R { TEP_R::new((self.bits & 0x0f) as u8) } #[doc = "Bits 4:5 - Protocol"] #[inline(always)] pub fn proto(&self) -> PROTO_R { PROTO_R::new(((self.bits >> 4) & 0x03) as u8) } #[doc = "Bits 6:7 - Operating Speed"] #[inline(always)] pub fn speed(&self) -> SPEED_R { SPEED_R::new(((self.bits >> 6) & 0x03) as u8) } } impl W { #[doc = "Bits 0:3 - Target Endpoint Number"] #[inline(always)] pub fn tep(&mut self) -> TEP_W { TEP_W { w: self } } #[doc = "Bits 4:5 - Protocol"] #[inline(always)] pub fn proto(&mut self) -> PROTO_W { PROTO_W { w: self } } #[doc = "Bits 6:7 - Operating Speed"] #[inline(always)] pub fn speed(&mut self) -> SPEED_W { SPEED_W { w: self } } }
#![allow(clippy::all)] pub struct Coordinate { pub latitude: f64, pub longitude: f64, } pub const UK_POLYGONS: [Coordinate; 3898] = [ Coordinate { latitude: 49.9116590000001, longitude: -6.31138900000002 }, Coordinate { latitude: 49.9119420000001, longitude: -6.31722300000001 }, Coordinate { latitude: 49.9152760000001, longitude: -6.3175 }, Coordinate { latitude: 49.9288860000001, longitude: -6.30805600000002 }, Coordinate { latitude: 49.9319380000001, longitude: -6.30555600000002 }, Coordinate { latitude: 49.9336090000001, longitude: -6.30139000000003 }, Coordinate { latitude: 49.9338840000001, longitude: -6.29499999999996 }, Coordinate { latitude: 49.929443, longitude: -6.28749999999997 }, Coordinate { latitude: 49.9266660000001, longitude: -6.28500099999997 }, Coordinate { latitude: 49.92083, longitude: -6.28000099999997 }, Coordinate { latitude: 49.918884, longitude: -6.27916699999992 }, Coordinate { latitude: 49.913887, longitude: -6.28638899999999 }, Coordinate { latitude: 49.912216, longitude: -6.29083299999996 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 50.6019440000001, longitude: -1.16833400000002 }, Coordinate { latitude: 50.593605, longitude: -1.19138899999996 }, Coordinate { latitude: 50.5872190000001, longitude: -1.21527800000001 }, Coordinate { latitude: 50.582497, longitude: -1.24166700000001 }, Coordinate { latitude: 50.578888, longitude: -1.28250000000003 }, Coordinate { latitude: 50.6186070000001, longitude: -1.36750000000001 }, Coordinate { latitude: 50.6608280000001, longitude: -1.47305599999993 }, Coordinate { latitude: 50.667221, longitude: -1.49361099999999 }, Coordinate { latitude: 50.6686100000001, longitude: -1.49916699999994 }, Coordinate { latitude: 50.668884, longitude: -1.51222200000001 }, Coordinate { latitude: 50.6674960000001, longitude: -1.52333399999998 }, Coordinate { latitude: 50.663605, longitude: -1.53805599999993 }, Coordinate { latitude: 50.6574940000001, longitude: -1.56916699999999 }, Coordinate { latitude: 50.6605530000001, longitude: -1.56999999999999 }, Coordinate { latitude: 50.675278, longitude: -1.55083300000001 }, Coordinate { latitude: 50.695274, longitude: -1.52333399999998 }, Coordinate { latitude: 50.771111, longitude: -1.30888900000002 }, Coordinate { latitude: 50.771942, longitude: -1.29694499999999 }, Coordinate { latitude: 50.7713850000001, longitude: -1.29138899999998 }, Coordinate { latitude: 50.737495, longitude: -1.11805600000002 }, Coordinate { latitude: 50.735275, longitude: -1.11388899999997 }, Coordinate { latitude: 50.7205509999999, longitude: -1.09388899999999 }, Coordinate { latitude: 50.6874920000001, longitude: -1.05972200000002 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 50.774437, longitude: -0.96055599999994 }, Coordinate { latitude: 50.7761080000001, longitude: -0.972778000000005 }, Coordinate { latitude: 50.785828, longitude: -1.02249999999998 }, Coordinate { latitude: 50.7894440000001, longitude: -1.02166699999998 }, Coordinate { latitude: 50.7919390000001, longitude: -1.018889 }, Coordinate { latitude: 50.830276, longitude: -0.975833000000023 }, Coordinate { latitude: 50.8308260000001, longitude: -0.970833000000027 }, Coordinate { latitude: 50.8297200000001, longitude: -0.964444999999955 }, Coordinate { latitude: 50.822495, longitude: -0.949166999999989 }, Coordinate { latitude: 50.8194430000001, longitude: -0.946389000000011 }, Coordinate { latitude: 50.7805480000001, longitude: -0.936110999999926 }, Coordinate { latitude: 50.777496, longitude: -0.938333 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 51.158333, longitude: -4.66361099999995 }, Coordinate { latitude: 51.159439, longitude: -4.66916800000001 }, Coordinate { latitude: 51.1613850000001, longitude: -4.67333400000001 }, Coordinate { latitude: 51.1652759999999, longitude: -4.67444499999999 }, Coordinate { latitude: 51.1852720000001, longitude: -4.67138999999992 }, Coordinate { latitude: 51.1930540000001, longitude: -4.66944499999994 }, Coordinate { latitude: 51.195, longitude: -4.66555599999992 }, Coordinate { latitude: 51.195, longitude: -4.65888999999993 }, Coordinate { latitude: 51.1922149999999, longitude: -4.65638899999999 }, Coordinate { latitude: 51.1644440000001, longitude: -4.646389 }, Coordinate { latitude: 51.160828, longitude: -4.64694499999996 }, Coordinate { latitude: 51.159439, longitude: -4.65166799999997 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 51.357216, longitude: 0.899166999999977 }, Coordinate { latitude: 51.3583300000001, longitude: 0.885278000000085 }, Coordinate { latitude: 51.3694379999999, longitude: 0.787500000000136 }, Coordinate { latitude: 51.370552, longitude: 0.781110999999953 }, Coordinate { latitude: 51.375832, longitude: 0.766111000000024 }, Coordinate { latitude: 51.3808290000001, longitude: 0.759443999999917 }, Coordinate { latitude: 51.3944400000001, longitude: 0.745278000000042 }, Coordinate { latitude: 51.4002760000001, longitude: 0.740832999999952 }, Coordinate { latitude: 51.4083329999999, longitude: 0.735000000000014 }, Coordinate { latitude: 51.4297180000001, longitude: 0.74055600000014 }, Coordinate { latitude: 51.4436040000001, longitude: 0.74888900000002 }, Coordinate { latitude: 51.444717, longitude: 0.760278000000028 }, Coordinate { latitude: 51.4399950000001, longitude: 0.791111000000114 }, Coordinate { latitude: 51.421387, longitude: 0.892222000000004 }, Coordinate { latitude: 51.418884, longitude: 0.904166999999973 }, Coordinate { latitude: 51.416939, longitude: 0.908889000000045 }, Coordinate { latitude: 51.3988880000001, longitude: 0.93055499999997 }, Coordinate { latitude: 51.393608, longitude: 0.936666999999943 }, Coordinate { latitude: 51.384995, longitude: 0.943889000000127 }, Coordinate { latitude: 51.3786090000001, longitude: 0.947500000000105 }, Coordinate { latitude: 51.374718, longitude: 0.947778000000028 }, Coordinate { latitude: 51.371109, longitude: 0.946943999999917 }, Coordinate { latitude: 51.369164, longitude: 0.942499999999939 }, Coordinate { latitude: 51.358055, longitude: 0.904722000000049 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 53.2380519999999, longitude: -4.57749999999999 }, Coordinate { latitude: 53.256104, longitude: -4.606945 }, Coordinate { latitude: 53.2783279999999, longitude: -4.66444499999994 }, Coordinate { latitude: 53.2802730000001, longitude: -4.67694499999999 }, Coordinate { latitude: 53.285553, longitude: -4.68305599999997 }, Coordinate { latitude: 53.301384, longitude: -4.69388999999995 }, Coordinate { latitude: 53.3041610000001, longitude: -4.69194499999998 }, Coordinate { latitude: 53.317772, longitude: -4.68138999999996 }, Coordinate { latitude: 53.320831, longitude: -4.67861199999999 }, Coordinate { latitude: 53.3213880000001, longitude: -4.67250100000001 }, Coordinate { latitude: 53.323051, longitude: -4.62666699999994 }, Coordinate { latitude: 53.3213880000001, longitude: -4.62166699999995 }, Coordinate { latitude: 53.2972180000001, longitude: -4.59083399999992 }, Coordinate { latitude: 53.2583310000001, longitude: -4.56055600000002 }, Coordinate { latitude: 53.25444, longitude: -4.55944499999993 }, Coordinate { latitude: 53.2505489999999, longitude: -4.55944499999993 }, Coordinate { latitude: 53.2463839999999, longitude: -4.560834 }, Coordinate { latitude: 53.243332, longitude: -4.56361199999992 }, Coordinate { latitude: 53.2386090000001, longitude: -4.57138900000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 53.200272, longitude: -4.21805599999999 }, Coordinate { latitude: 53.144997, longitude: -4.32555600000001 }, Coordinate { latitude: 53.124443, longitude: -4.35138899999998 }, Coordinate { latitude: 53.125832, longitude: -4.40222299999994 }, Coordinate { latitude: 53.176666, longitude: -4.47888899999992 }, Coordinate { latitude: 53.189438, longitude: -4.49444499999998 }, Coordinate { latitude: 53.273331, longitude: -4.5675 }, Coordinate { latitude: 53.3880540000001, longitude: -4.56916699999999 }, Coordinate { latitude: 53.3913880000001, longitude: -4.56694499999998 }, Coordinate { latitude: 53.3966600000001, longitude: -4.56 }, Coordinate { latitude: 53.4186100000001, longitude: -4.47472299999993 }, Coordinate { latitude: 53.424438, longitude: -4.42916699999995 }, Coordinate { latitude: 53.4249950000001, longitude: -4.42305599999997 }, Coordinate { latitude: 53.4249950000001, longitude: -4.416112 }, Coordinate { latitude: 53.4119420000001, longitude: -4.31388999999996 }, Coordinate { latitude: 53.4074940000001, longitude: -4.29250000000002 }, Coordinate { latitude: 53.403328, longitude: -4.28361099999995 }, Coordinate { latitude: 53.3983310000001, longitude: -4.27694499999996 }, Coordinate { latitude: 53.388611, longitude: -4.26999999999998 }, Coordinate { latitude: 53.3216630000001, longitude: -4.22222199999999 }, Coordinate { latitude: 53.3105550000001, longitude: -4.12694499999998 }, Coordinate { latitude: 53.311943, longitude: -4.12222299999996 }, Coordinate { latitude: 53.312492, longitude: -4.11583400000001 }, Coordinate { latitude: 53.312218, longitude: -4.11000100000001 }, Coordinate { latitude: 53.3055500000001, longitude: -4.05999999999995 }, Coordinate { latitude: 53.303329, longitude: -4.04666699999996 }, Coordinate { latitude: 53.299721, longitude: -4.04638999999997 }, Coordinate { latitude: 53.2549970000001, longitude: -4.08999999999998 }, Coordinate { latitude: 53.2477720000001, longitude: -4.10138899999993 }, Coordinate { latitude: 53.225555, longitude: -4.15333399999997 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 55.2119370000001, longitude: -6.255 }, Coordinate { latitude: 55.2186050000001, longitude: -6.16833400000002 }, Coordinate { latitude: 55.2211070000001, longitude: -6.14944499999996 }, Coordinate { latitude: 55.2202760000001, longitude: -6.14222199999995 }, Coordinate { latitude: 55.2102740000001, longitude: -6.10388899999998 }, Coordinate { latitude: 55.208611, longitude: -6.098612 }, Coordinate { latitude: 55.194443, longitude: -6.06666799999994 }, Coordinate { latitude: 55.1886060000001, longitude: -6.060834 }, Coordinate { latitude: 55.1616590000001, longitude: -6.03750000000002 }, Coordinate { latitude: 55.1549990000001, longitude: -6.03361099999995 }, Coordinate { latitude: 55.150833, longitude: -6.03333400000002 }, Coordinate { latitude: 55.1027760000001, longitude: -6.04250000000002 }, Coordinate { latitude: 55.0872190000001, longitude: -6.04944499999999 }, Coordinate { latitude: 55.0577769999999, longitude: -6.03611199999995 }, Coordinate { latitude: 54.8961110000001, longitude: -5.84444499999995 }, Coordinate { latitude: 54.851387, longitude: -5.79138899999998 }, Coordinate { latitude: 54.854996, longitude: -5.78194500000001 }, Coordinate { latitude: 54.8555530000001, longitude: -5.77555599999994 }, Coordinate { latitude: 54.853607, longitude: -5.74694499999998 }, Coordinate { latitude: 54.850273, longitude: -5.73638899999992 }, Coordinate { latitude: 54.848328, longitude: -5.73194499999994 }, Coordinate { latitude: 54.8330540000001, longitude: -5.710556 }, Coordinate { latitude: 54.8302760000001, longitude: -5.708056 }, Coordinate { latitude: 54.8122180000001, longitude: -5.69277899999992 }, Coordinate { latitude: 54.8061070000001, longitude: -5.68805599999996 }, Coordinate { latitude: 54.7712330000001, longitude: -5.68652800000001 }, Coordinate { latitude: 54.7649990000001, longitude: -5.68638899999996 }, Coordinate { latitude: 54.761108, longitude: -5.68749999999994 }, Coordinate { latitude: 54.7561040000001, longitude: -5.69055599999996 }, Coordinate { latitude: 54.751938, longitude: -5.69333399999994 }, Coordinate { latitude: 54.7488860000001, longitude: -5.69638900000001 }, Coordinate { latitude: 54.739166, longitude: -5.71111200000001 }, Coordinate { latitude: 54.725441, longitude: -5.74255599999992 }, Coordinate { latitude: 54.7244420000001, longitude: -5.74555600000002 }, Coordinate { latitude: 54.724106, longitude: -5.74938899999995 }, Coordinate { latitude: 54.724106, longitude: -5.76705599999997 }, Coordinate { latitude: 54.7197189999999, longitude: -5.78583300000003 }, Coordinate { latitude: 54.710548, longitude: -5.81638900000002 }, Coordinate { latitude: 54.7088850000001, longitude: -5.82166699999999 }, Coordinate { latitude: 54.6919400000001, longitude: -5.86250000000001 }, Coordinate { latitude: 54.6874920000001, longitude: -5.87111199999998 }, Coordinate { latitude: 54.6824950000001, longitude: -5.87805599999996 }, Coordinate { latitude: 54.674721, longitude: -5.88833399999993 }, Coordinate { latitude: 54.671387, longitude: -5.891389 }, Coordinate { latitude: 54.6338880000001, longitude: -5.92388899999992 }, Coordinate { latitude: 54.629715, longitude: -5.92500000000001 }, Coordinate { latitude: 54.604721, longitude: -5.90833399999997 }, Coordinate { latitude: 54.602219, longitude: -5.90472299999999 }, Coordinate { latitude: 54.601105, longitude: -5.89833399999992 }, Coordinate { latitude: 54.6033330000001, longitude: -5.88722199999995 }, Coordinate { latitude: 54.6055529999999, longitude: -5.88305599999995 }, Coordinate { latitude: 54.608604, longitude: -5.87999999999994 }, Coordinate { latitude: 54.6197200000001, longitude: -5.87472199999996 }, Coordinate { latitude: 54.637497, longitude: -5.85583400000002 }, Coordinate { latitude: 54.6555480000001, longitude: -5.81638900000002 }, Coordinate { latitude: 54.6613850000001, longitude: -5.80305600000003 }, Coordinate { latitude: 54.673164, longitude: -5.74061199999994 }, Coordinate { latitude: 54.6738320000001, longitude: -5.73811099999995 }, Coordinate { latitude: 54.6741640000001, longitude: -5.73411199999993 }, Coordinate { latitude: 54.6794429999999, longitude: -5.62916799999999 }, Coordinate { latitude: 54.6791610000001, longitude: -5.59916699999997 }, Coordinate { latitude: 54.678055, longitude: -5.57694500000002 }, Coordinate { latitude: 54.676384, longitude: -5.57166699999999 }, Coordinate { latitude: 54.6544420000001, longitude: -5.53888899999993 }, Coordinate { latitude: 54.651939, longitude: -5.53527799999995 }, Coordinate { latitude: 54.648605, longitude: -5.53333399999997 }, Coordinate { latitude: 54.6299970000001, longitude: -5.52777899999995 }, Coordinate { latitude: 54.5363850000001, longitude: -5.479445 }, Coordinate { latitude: 54.4894410000001, longitude: -5.43527799999993 }, Coordinate { latitude: 54.487221, longitude: -5.43055600000002 }, Coordinate { latitude: 54.4836040000001, longitude: -5.42972300000002 }, Coordinate { latitude: 54.4605480000001, longitude: -5.43527799999993 }, Coordinate { latitude: 54.4563830000001, longitude: -5.43638900000002 }, Coordinate { latitude: 54.3855510000001, longitude: -5.46111199999996 }, Coordinate { latitude: 54.364609, longitude: -5.50088999999997 }, Coordinate { latitude: 54.363773, longitude: -5.50389000000001 }, Coordinate { latitude: 54.3636090000001, longitude: -5.50805600000001 }, Coordinate { latitude: 54.365776, longitude: -5.51405599999998 }, Coordinate { latitude: 54.369106, longitude: -5.51772299999999 }, Coordinate { latitude: 54.4014400000001, longitude: -5.54522300000002 }, Coordinate { latitude: 54.4034390000001, longitude: -5.54638999999992 }, Coordinate { latitude: 54.4056090000001, longitude: -5.54689000000002 }, Coordinate { latitude: 54.410606, longitude: -5.54722299999992 }, Coordinate { latitude: 54.4149440000001, longitude: -5.54572300000001 }, Coordinate { latitude: 54.417107, longitude: -5.54438900000002 }, Coordinate { latitude: 54.418938, longitude: -5.54289 }, Coordinate { latitude: 54.426777, longitude: -5.53222299999999 }, Coordinate { latitude: 54.4416660000001, longitude: -5.54583400000001 }, Coordinate { latitude: 54.448883, longitude: -5.54166700000002 }, Coordinate { latitude: 54.452774, longitude: -5.54055599999992 }, Coordinate { latitude: 54.4769440000001, longitude: -5.54361199999994 }, Coordinate { latitude: 54.4991610000001, longitude: -5.55000000000001 }, Coordinate { latitude: 54.5024950000001, longitude: -5.55194499999999 }, Coordinate { latitude: 54.515831, longitude: -5.55972299999996 }, Coordinate { latitude: 54.518883, longitude: -5.561667 }, Coordinate { latitude: 54.524437, longitude: -5.56805599999996 }, Coordinate { latitude: 54.541939, longitude: -5.59972299999998 }, Coordinate { latitude: 54.5591660000001, longitude: -5.63944499999997 }, Coordinate { latitude: 54.566383, longitude: -5.65916700000002 }, Coordinate { latitude: 54.5730510000001, longitude: -5.68055599999997 }, Coordinate { latitude: 54.575272, longitude: -5.69277899999992 }, Coordinate { latitude: 54.5741650000001, longitude: -5.69861100000003 }, Coordinate { latitude: 54.5705490000001, longitude: -5.70055600000001 }, Coordinate { latitude: 54.533607, longitude: -5.704722 }, Coordinate { latitude: 54.523048, longitude: -5.67583400000001 }, Coordinate { latitude: 54.5216600000001, longitude: -5.67138999999997 }, Coordinate { latitude: 54.492676, longitude: -5.64502099999993 }, Coordinate { latitude: 54.377033, longitude: -5.57333799999992 }, Coordinate { latitude: 54.366867, longitude: -5.568172 }, Coordinate { latitude: 54.3447, longitude: -5.561172 }, Coordinate { latitude: 54.342865, longitude: -5.562838 }, Coordinate { latitude: 54.2908330000001, longitude: -5.559167 }, Coordinate { latitude: 54.2830510000001, longitude: -5.56222199999996 }, Coordinate { latitude: 54.264999, longitude: -5.58666699999992 }, Coordinate { latitude: 54.2497180000001, longitude: -5.60833399999996 }, Coordinate { latitude: 54.2272189999999, longitude: -5.64805599999994 }, Coordinate { latitude: 54.2255550000001, longitude: -5.65333399999997 }, Coordinate { latitude: 54.226387, longitude: -5.65861099999995 }, Coordinate { latitude: 54.2288820000001, longitude: -5.66222299999993 }, Coordinate { latitude: 54.2349930000001, longitude: -5.666945 }, Coordinate { latitude: 54.2430500000001, longitude: -5.68444499999998 }, Coordinate { latitude: 54.2447200000001, longitude: -5.69000099999994 }, Coordinate { latitude: 54.245552, longitude: -5.69694500000003 }, Coordinate { latitude: 54.2474980000001, longitude: -5.73055599999992 }, Coordinate { latitude: 54.2480550000001, longitude: -5.74611199999998 }, Coordinate { latitude: 54.240273, longitude: -5.82249999999999 }, Coordinate { latitude: 54.238884, longitude: -5.82749999999999 }, Coordinate { latitude: 54.2280499999999, longitude: -5.85555599999992 }, Coordinate { latitude: 54.2238849999999, longitude: -5.86388999999997 }, Coordinate { latitude: 54.213333, longitude: -5.87305599999996 }, Coordinate { latitude: 54.2049940000001, longitude: -5.87388899999996 }, Coordinate { latitude: 54.1974950000001, longitude: -5.87194499999998 }, Coordinate { latitude: 54.187775, longitude: -5.86583400000001 }, Coordinate { latitude: 54.183884, longitude: -5.86500100000001 }, Coordinate { latitude: 54.171387, longitude: -5.86388999999997 }, Coordinate { latitude: 54.1624980000001, longitude: -5.86527799999999 }, Coordinate { latitude: 54.116386, longitude: -5.88499999999993 }, Coordinate { latitude: 54.099442, longitude: -5.896389 }, Coordinate { latitude: 54.0941620000001, longitude: -5.90361100000001 }, Coordinate { latitude: 54.085831, longitude: -5.92027899999994 }, Coordinate { latitude: 54.0638890000001, longitude: -5.96833400000003 }, Coordinate { latitude: 54.0313869999999, longitude: -6.04388899999992 }, Coordinate { latitude: 54.0277710000001, longitude: -6.06777899999997 }, Coordinate { latitude: 54.027496, longitude: -6.07500099999993 }, Coordinate { latitude: 54.028328, longitude: -6.08194400000002 }, Coordinate { latitude: 54.0363849999999, longitude: -6.10833399999996 }, Coordinate { latitude: 54.069443, longitude: -6.17083400000001 }, Coordinate { latitude: 54.0749970000001, longitude: -6.17722199999997 }, Coordinate { latitude: 54.0874940000001, longitude: -6.18583399999994 }, Coordinate { latitude: 54.09333, longitude: -6.19222300000001 }, Coordinate { latitude: 54.0952760000001, longitude: -6.19666699999993 }, Coordinate { latitude: 54.096664, longitude: -6.20277800000002 }, Coordinate { latitude: 54.099831, longitude: -6.26697499999995 }, Coordinate { latitude: 54.1019440000001, longitude: -6.26750099999992 }, Coordinate { latitude: 54.1049960000001, longitude: -6.27249999999992 }, Coordinate { latitude: 54.107216, longitude: -6.27861100000001 }, Coordinate { latitude: 54.1086040000001, longitude: -6.288611 }, Coordinate { latitude: 54.115555, longitude: -6.33888899999994 }, Coordinate { latitude: 54.115555, longitude: -6.34972299999993 }, Coordinate { latitude: 54.114166, longitude: -6.35500000000002 }, Coordinate { latitude: 54.1116640000001, longitude: -6.36000100000001 }, Coordinate { latitude: 54.1086040000001, longitude: -6.36361099999999 }, Coordinate { latitude: 54.105553, longitude: -6.36527799999999 }, Coordinate { latitude: 54.102493, longitude: -6.36611199999999 }, Coordinate { latitude: 54.099442, longitude: -6.36583399999995 }, Coordinate { latitude: 54.058327, longitude: -6.44749999999999 }, Coordinate { latitude: 54.0508270000001, longitude: -6.56749999999994 }, Coordinate { latitude: 54.044441, longitude: -6.60583399999996 }, Coordinate { latitude: 54.042221, longitude: -6.60805599999992 }, Coordinate { latitude: 54.0372159999999, longitude: -6.620001 }, Coordinate { latitude: 54.039162, longitude: -6.625 }, Coordinate { latitude: 54.0452730000001, longitude: -6.63250099999999 }, Coordinate { latitude: 54.065277, longitude: -6.65555599999993 }, Coordinate { latitude: 54.1836089999999, longitude: -6.73472299999992 }, Coordinate { latitude: 54.2874980000001, longitude: -6.85166700000002 }, Coordinate { latitude: 54.2919390000001, longitude: -6.85055599999998 }, Coordinate { latitude: 54.338882, longitude: -6.87000099999995 }, Coordinate { latitude: 54.345276, longitude: -6.87611199999992 }, Coordinate { latitude: 54.373604, longitude: -6.91722299999992 }, Coordinate { latitude: 54.3791660000001, longitude: -6.92694499999999 }, Coordinate { latitude: 54.4016650000001, longitude: -6.974445 }, Coordinate { latitude: 54.4169390000001, longitude: -7.02527799999996 }, Coordinate { latitude: 54.41777, longitude: -7.03083400000003 }, Coordinate { latitude: 54.417221, longitude: -7.03638899999993 }, Coordinate { latitude: 54.409996, longitude: -7.05833299999995 }, Coordinate { latitude: 54.336662, longitude: -7.16083299999997 }, Coordinate { latitude: 54.289162, longitude: -7.17555600000003 }, Coordinate { latitude: 54.2588880000001, longitude: -7.14499999999993 }, Coordinate { latitude: 54.255829, longitude: -7.14250099999992 }, Coordinate { latitude: 54.252495, longitude: -7.14138899999995 }, Coordinate { latitude: 54.2252730000001, longitude: -7.14583399999992 }, Coordinate { latitude: 54.1249920000001, longitude: -7.28083399999997 }, Coordinate { latitude: 54.1219410000001, longitude: -7.28694499999995 }, Coordinate { latitude: 54.1124950000001, longitude: -7.313334 }, Coordinate { latitude: 54.113052, longitude: -7.33027800000002 }, Coordinate { latitude: 54.1269380000001, longitude: -7.55944499999993 }, Coordinate { latitude: 54.142494, longitude: -7.61000100000001 }, Coordinate { latitude: 54.1461110000001, longitude: -7.620001 }, Coordinate { latitude: 54.1488880000001, longitude: -7.62361099999998 }, Coordinate { latitude: 54.1555480000001, longitude: -7.624167 }, Coordinate { latitude: 54.163055, longitude: -7.62305599999996 }, Coordinate { latitude: 54.1663820000001, longitude: -7.62444499999998 }, Coordinate { latitude: 54.1697160000001, longitude: -7.62777799999998 }, Coordinate { latitude: 54.2024990000001, longitude: -7.69694499999997 }, Coordinate { latitude: 54.2024990000001, longitude: -7.70249999999999 }, Coordinate { latitude: 54.200272, longitude: -7.74777799999998 }, Coordinate { latitude: 54.1991650000001, longitude: -7.81555599999996 }, Coordinate { latitude: 54.1991650000001, longitude: -7.82055599999995 }, Coordinate { latitude: 54.212219, longitude: -7.85138899999998 }, Coordinate { latitude: 54.218048, longitude: -7.86194499999993 }, Coordinate { latitude: 54.2241590000001, longitude: -7.86749999999995 }, Coordinate { latitude: 54.23111, longitude: -7.86916699999995 }, Coordinate { latitude: 54.2530520000001, longitude: -7.86944499999993 }, Coordinate { latitude: 54.282494, longitude: -7.87472200000002 }, Coordinate { latitude: 54.285828, longitude: -7.87555600000002 }, Coordinate { latitude: 54.289162, longitude: -7.87805600000002 }, Coordinate { latitude: 54.294167, longitude: -7.90027799999996 }, Coordinate { latitude: 54.2994380000001, longitude: -7.94138899999996 }, Coordinate { latitude: 54.3572160000001, longitude: -8.03027900000001 }, Coordinate { latitude: 54.361382, longitude: -8.04527899999999 }, Coordinate { latitude: 54.366386, longitude: -8.05583399999995 }, Coordinate { latitude: 54.3727720000001, longitude: -8.06555600000002 }, Coordinate { latitude: 54.438606, longitude: -8.15666799999997 }, Coordinate { latitude: 54.44194, longitude: -8.15944499999995 }, Coordinate { latitude: 54.4638790000001, longitude: -8.17166599999996 }, Coordinate { latitude: 54.507217, longitude: -8.04694599999993 }, Coordinate { latitude: 54.5322190000001, longitude: -7.95083399999993 }, Coordinate { latitude: 54.553886, longitude: -7.83361100000002 }, Coordinate { latitude: 54.5944440000001, longitude: -7.75222300000002 }, Coordinate { latitude: 54.6269380000001, longitude: -7.77749999999998 }, Coordinate { latitude: 54.633049, longitude: -7.849445 }, Coordinate { latitude: 54.6347200000001, longitude: -7.855278 }, Coordinate { latitude: 54.6644440000001, longitude: -7.90638899999993 }, Coordinate { latitude: 54.6711040000001, longitude: -7.91388899999993 }, Coordinate { latitude: 54.6988830000001, longitude: -7.92750099999995 }, Coordinate { latitude: 54.7022170000001, longitude: -7.92527899999999 }, Coordinate { latitude: 54.733604, longitude: -7.84305599999999 }, Coordinate { latitude: 54.7355500000001, longitude: -7.82972199999995 }, Coordinate { latitude: 54.7344440000001, longitude: -7.82444500000003 }, Coordinate { latitude: 54.7311100000001, longitude: -7.81916699999999 }, Coordinate { latitude: 54.710548, longitude: -7.73916699999995 }, Coordinate { latitude: 54.762772, longitude: -7.55333399999995 }, Coordinate { latitude: 54.829933, longitude: -7.48283900000001 }, Coordinate { latitude: 54.8577730000001, longitude: -7.458056 }, Coordinate { latitude: 54.8825, longitude: -7.44388999999995 }, Coordinate { latitude: 54.953331, longitude: -7.40638899999993 }, Coordinate { latitude: 55.0452730000001, longitude: -7.32638899999995 }, Coordinate { latitude: 55.070595, longitude: -7.25250699999992 }, Coordinate { latitude: 55.0474930000001, longitude: -7.25499999999994 }, Coordinate { latitude: 55.0461040000001, longitude: -7.25111199999998 }, Coordinate { latitude: 55.036942, longitude: -7.09499999999997 }, Coordinate { latitude: 55.037773, longitude: -7.07361100000003 }, Coordinate { latitude: 55.0405500000001, longitude: -7.06416699999994 }, Coordinate { latitude: 55.044441, longitude: -7.05527799999999 }, Coordinate { latitude: 55.049164, longitude: -7.04750100000001 }, Coordinate { latitude: 55.061943, longitude: -7.02916699999992 }, Coordinate { latitude: 55.0702739999999, longitude: -7.01972299999994 }, Coordinate { latitude: 55.1102750000001, longitude: -6.994167 }, Coordinate { latitude: 55.1561050000001, longitude: -6.96694500000001 }, Coordinate { latitude: 55.16777, longitude: -6.889723 }, Coordinate { latitude: 55.168053, longitude: -6.82472199999995 }, Coordinate { latitude: 55.1802750000001, longitude: -6.730278 }, Coordinate { latitude: 55.2072220000001, longitude: -6.61333400000001 }, Coordinate { latitude: 55.233055, longitude: -6.515556 }, Coordinate { latitude: 55.2391660000001, longitude: -6.37638999999996 }, Coordinate { latitude: 55.237778, longitude: -6.35333300000002 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 55.264999, longitude: -6.18111099999999 }, Coordinate { latitude: 55.2613830000001, longitude: -6.18472299999996 }, Coordinate { latitude: 55.25972, longitude: -6.18833399999994 }, Coordinate { latitude: 55.291382, longitude: -6.23444499999994 }, Coordinate { latitude: 55.2902760000001, longitude: -6.26277800000003 }, Coordinate { latitude: 55.290833, longitude: -6.27777900000001 }, Coordinate { latitude: 55.2922209999999, longitude: -6.28249999999997 }, Coordinate { latitude: 55.296387, longitude: -6.28138899999999 }, Coordinate { latitude: 55.303886, longitude: -6.26277800000003 }, Coordinate { latitude: 55.3077770000001, longitude: -6.252501 }, Coordinate { latitude: 55.308609, longitude: -6.23889000000003 }, Coordinate { latitude: 55.3024980000001, longitude: -6.19111199999992 }, Coordinate { latitude: 55.299721, longitude: -6.17833399999995 }, Coordinate { latitude: 55.297493, longitude: -6.17472299999997 }, Coordinate { latitude: 55.293053, longitude: -6.17277799999999 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 55.429443, longitude: -5.17194499999999 }, Coordinate { latitude: 55.429993, longitude: -5.22361199999995 }, Coordinate { latitude: 55.4302750000001, longitude: -5.23166799999996 }, Coordinate { latitude: 55.431938, longitude: -5.23694499999993 }, Coordinate { latitude: 55.446938, longitude: -5.28333400000002 }, Coordinate { latitude: 55.4511110000001, longitude: -5.292778 }, Coordinate { latitude: 55.4749980000001, longitude: -5.34027899999995 }, Coordinate { latitude: 55.477219, longitude: -5.34222299999999 }, Coordinate { latitude: 55.504166, longitude: -5.35722299999992 }, Coordinate { latitude: 55.6005550000001, longitude: -5.40027800000001 }, Coordinate { latitude: 55.6088870000001, longitude: -5.40083399999992 }, Coordinate { latitude: 55.6177750000001, longitude: -5.40027800000001 }, Coordinate { latitude: 55.6288830000001, longitude: -5.396389 }, Coordinate { latitude: 55.6686100000001, longitude: -5.38111099999998 }, Coordinate { latitude: 55.671661, longitude: -5.37805599999996 }, Coordinate { latitude: 55.6769410000001, longitude: -5.370833 }, Coordinate { latitude: 55.699715, longitude: -5.33000099999998 }, Coordinate { latitude: 55.7019420000001, longitude: -5.32555600000001 }, Coordinate { latitude: 55.71666, longitude: -5.29527899999999 }, Coordinate { latitude: 55.7172160000001, longitude: -5.26555599999995 }, Coordinate { latitude: 55.7161100000001, longitude: -5.25194499999998 }, Coordinate { latitude: 55.713608, longitude: -5.23916700000001 }, Coordinate { latitude: 55.710274, longitude: -5.22833299999996 }, Coordinate { latitude: 55.699165, longitude: -5.19833399999993 }, Coordinate { latitude: 55.692772, longitude: -5.18527799999998 }, Coordinate { latitude: 55.6841660000001, longitude: -5.16805599999992 }, Coordinate { latitude: 55.679161, longitude: -5.16027799999995 }, Coordinate { latitude: 55.673332, longitude: -5.15472299999993 }, Coordinate { latitude: 55.5566640000001, longitude: -5.08527900000001 }, Coordinate { latitude: 55.553055, longitude: -5.08388899999994 }, Coordinate { latitude: 55.4633330000001, longitude: -5.07472199999995 }, Coordinate { latitude: 55.4591600000001, longitude: -5.07444499999997 }, Coordinate { latitude: 55.4552760000001, longitude: -5.07583399999999 }, Coordinate { latitude: 55.4522170000001, longitude: -5.07888899999995 }, Coordinate { latitude: 55.4416660000001, longitude: -5.09333400000003 }, Coordinate { latitude: 55.438606, longitude: -5.103612 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 55.7213820000001, longitude: -5.023056 }, Coordinate { latitude: 55.722221, longitude: -5.03027800000001 }, Coordinate { latitude: 55.7241589999999, longitude: -5.03472199999999 }, Coordinate { latitude: 55.7772219999999, longitude: -5.11889000000002 }, Coordinate { latitude: 55.780273, longitude: -5.12194499999993 }, Coordinate { latitude: 55.8741610000001, longitude: -5.19861100000003 }, Coordinate { latitude: 55.8774950000001, longitude: -5.20055599999995 }, Coordinate { latitude: 55.8919370000001, longitude: -5.20583299999993 }, Coordinate { latitude: 55.895828, longitude: -5.20666699999992 }, Coordinate { latitude: 55.899437, longitude: -5.206389 }, Coordinate { latitude: 55.918053, longitude: -5.181667 }, Coordinate { latitude: 55.919998, longitude: -5.17694499999999 }, Coordinate { latitude: 55.918884, longitude: -5.17055599999992 }, Coordinate { latitude: 55.9152760000001, longitude: -5.16055599999993 }, Coordinate { latitude: 55.8769380000001, longitude: -5.08027799999996 }, Coordinate { latitude: 55.837776, longitude: -5.03638899999999 }, Coordinate { latitude: 55.783051, longitude: -5.00888899999995 }, Coordinate { latitude: 55.776108, longitude: -5.00555599999996 }, Coordinate { latitude: 55.767776, longitude: -5.00527899999997 }, Coordinate { latitude: 55.730553, longitude: -5.00694499999997 }, Coordinate { latitude: 55.726944, longitude: -5.00916699999993 }, Coordinate { latitude: 55.7219390000001, longitude: -5.016389 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 55.8111040000001, longitude: -6.10305599999998 }, Coordinate { latitude: 55.8072200000001, longitude: -6.10194499999994 }, Coordinate { latitude: 55.796661, longitude: -6.09750099999997 }, Coordinate { latitude: 55.789993, longitude: -6.09333399999997 }, Coordinate { latitude: 55.783882, longitude: -6.08833399999992 }, Coordinate { latitude: 55.7774960000001, longitude: -6.07555599999995 }, Coordinate { latitude: 55.7722170000001, longitude: -6.05944499999998 }, Coordinate { latitude: 55.76722, longitude: -6.05222200000003 }, Coordinate { latitude: 55.7641600000001, longitude: -6.05000000000001 }, Coordinate { latitude: 55.7205510000001, longitude: -6.03027799999995 }, Coordinate { latitude: 55.6808320000001, longitude: -6.02472299999999 }, Coordinate { latitude: 55.6777730000001, longitude: -6.02749999999998 }, Coordinate { latitude: 55.669998, longitude: -6.03833400000002 }, Coordinate { latitude: 55.6499940000001, longitude: -6.07666699999993 }, Coordinate { latitude: 55.5922160000001, longitude: -6.22888899999992 }, Coordinate { latitude: 55.572777, longitude: -6.27444500000001 }, Coordinate { latitude: 55.576942, longitude: -6.30055600000003 }, Coordinate { latitude: 55.581665, longitude: -6.31722300000001 }, Coordinate { latitude: 55.5866620000001, longitude: -6.32555600000001 }, Coordinate { latitude: 55.589439, longitude: -6.32749999999999 }, Coordinate { latitude: 55.615273, longitude: -6.32194499999997 }, Coordinate { latitude: 55.6188890000001, longitude: -6.32083399999999 }, Coordinate { latitude: 55.7072220000001, longitude: -6.28583299999997 }, Coordinate { latitude: 55.763611, longitude: -6.25305599999996 }, Coordinate { latitude: 55.76722, longitude: -6.25111199999998 }, Coordinate { latitude: 55.771385, longitude: -6.25138999999996 }, Coordinate { latitude: 55.774719, longitude: -6.25444499999998 }, Coordinate { latitude: 55.776665, longitude: -6.25916699999993 }, Coordinate { latitude: 55.7777710000001, longitude: -6.26527800000002 }, Coordinate { latitude: 55.7813869999999, longitude: -6.32527799999997 }, Coordinate { latitude: 55.7813869999999, longitude: -6.33166699999998 }, Coordinate { latitude: 55.780273, longitude: -6.33777799999996 }, Coordinate { latitude: 55.774994, longitude: -6.34555599999993 }, Coordinate { latitude: 55.771385, longitude: -6.34833300000003 }, Coordinate { latitude: 55.764717, longitude: -6.35250100000002 }, Coordinate { latitude: 55.758049, longitude: -6.35638899999992 }, Coordinate { latitude: 55.750275, longitude: -6.36055599999997 }, Coordinate { latitude: 55.7408290000001, longitude: -6.36749999999995 }, Coordinate { latitude: 55.72805, longitude: -6.37972300000001 }, Coordinate { latitude: 55.7172160000001, longitude: -6.393056 }, Coordinate { latitude: 55.7038880000001, longitude: -6.41083299999997 }, Coordinate { latitude: 55.6802750000001, longitude: -6.44944499999997 }, Coordinate { latitude: 55.673882, longitude: -6.46250099999992 }, Coordinate { latitude: 55.669998, longitude: -6.47333300000003 }, Coordinate { latitude: 55.6686100000001, longitude: -6.48500099999995 }, Coordinate { latitude: 55.6694409999999, longitude: -6.49138900000003 }, Coordinate { latitude: 55.673332, longitude: -6.50139000000001 }, Coordinate { latitude: 55.676666, longitude: -6.505 }, Coordinate { latitude: 55.68222, longitude: -6.50916699999999 }, Coordinate { latitude: 55.690552, longitude: -6.50999999999999 }, Coordinate { latitude: 55.7213820000001, longitude: -6.49999999999994 }, Coordinate { latitude: 55.733604, longitude: -6.49527799999993 }, Coordinate { latitude: 55.8486100000001, longitude: -6.44972199999995 }, Coordinate { latitude: 55.853607, longitude: -6.44166799999999 }, Coordinate { latitude: 55.8694379999999, longitude: -6.36972199999997 }, Coordinate { latitude: 55.8636090000001, longitude: -6.30972300000002 }, Coordinate { latitude: 55.9163820000001, longitude: -6.19222300000001 }, Coordinate { latitude: 55.9274980000001, longitude: -6.16305599999993 }, Coordinate { latitude: 55.933609, longitude: -6.14194499999996 }, Coordinate { latitude: 55.934441, longitude: -6.13666699999999 }, Coordinate { latitude: 55.933609, longitude: -6.12944499999998 }, Coordinate { latitude: 55.928886, longitude: -6.12194499999993 }, Coordinate { latitude: 55.9216610000001, longitude: -6.11861099999993 }, Coordinate { latitude: 55.894997, longitude: -6.12277799999993 }, Coordinate { latitude: 55.878883, longitude: -6.121667 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.0280530000001, longitude: -6.20000099999999 }, Coordinate { latitude: 56.031944, longitude: -6.24055600000003 }, Coordinate { latitude: 56.0361100000001, longitude: -6.26305599999995 }, Coordinate { latitude: 56.0772170000001, longitude: -6.23416700000001 }, Coordinate { latitude: 56.0827710000001, longitude: -6.22861199999994 }, Coordinate { latitude: 56.0958329999999, longitude: -6.210556 }, Coordinate { latitude: 56.100555, longitude: -6.20249999999999 }, Coordinate { latitude: 56.113052, longitude: -6.17861199999999 }, Coordinate { latitude: 56.1152730000001, longitude: -6.17361199999999 }, Coordinate { latitude: 56.1216660000001, longitude: -6.13888899999995 }, Coordinate { latitude: 56.1208270000001, longitude: -6.13083399999999 }, Coordinate { latitude: 56.1172180000001, longitude: -6.12972300000001 }, Coordinate { latitude: 56.039162, longitude: -6.17805599999997 }, Coordinate { latitude: 56.03083, longitude: -6.18972300000002 }, Coordinate { latitude: 56.02916, longitude: -6.19389000000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 55.78833, longitude: -5.97194500000001 }, Coordinate { latitude: 55.791664, longitude: -6.02722299999999 }, Coordinate { latitude: 55.7930530000001, longitude: -6.03250000000003 }, Coordinate { latitude: 55.800278, longitude: -6.05305599999997 }, Coordinate { latitude: 55.8038860000001, longitude: -6.06305599999996 }, Coordinate { latitude: 55.808327, longitude: -6.07055599999995 }, Coordinate { latitude: 55.811661, longitude: -6.07361100000003 }, Coordinate { latitude: 55.8155520000001, longitude: -6.07555599999995 }, Coordinate { latitude: 55.8266600000001, longitude: -6.07916699999993 }, Coordinate { latitude: 55.8774950000001, longitude: -6.08805599999999 }, Coordinate { latitude: 55.8816600000001, longitude: -6.08777800000001 }, Coordinate { latitude: 55.894165, longitude: -6.08444500000002 }, Coordinate { latitude: 55.9055480000001, longitude: -6.07888899999995 }, Coordinate { latitude: 56.023605, longitude: -5.96805599999993 }, Coordinate { latitude: 56.0305480000001, longitude: -5.95583299999998 }, Coordinate { latitude: 56.0583270000001, longitude: -5.90638899999999 }, Coordinate { latitude: 56.060829, longitude: -5.90166799999997 }, Coordinate { latitude: 56.109718, longitude: -5.80916699999995 }, Coordinate { latitude: 56.1333310000001, longitude: -5.755 }, Coordinate { latitude: 56.1374970000001, longitude: -5.745001 }, Coordinate { latitude: 56.1502760000001, longitude: -5.71138999999999 }, Coordinate { latitude: 56.150833, longitude: -5.705556 }, Coordinate { latitude: 56.1472170000001, longitude: -5.69444499999992 }, Coordinate { latitude: 56.1258320000001, longitude: -5.68499999999995 }, Coordinate { latitude: 56.121941, longitude: -5.68444499999998 }, Coordinate { latitude: 56.1174930000001, longitude: -5.68444499999998 }, Coordinate { latitude: 56.113052, longitude: -5.68611099999998 }, Coordinate { latitude: 56.106667, longitude: -5.69083399999994 }, Coordinate { latitude: 56.0988850000001, longitude: -5.70249999999993 }, Coordinate { latitude: 56.096107, longitude: -5.708056 }, Coordinate { latitude: 56.0894390000001, longitude: -5.71694499999995 }, Coordinate { latitude: 56.078049, longitude: -5.73027799999994 }, Coordinate { latitude: 56.0636060000001, longitude: -5.74611199999998 }, Coordinate { latitude: 56.0569379999999, longitude: -5.75194499999998 }, Coordinate { latitude: 55.9494399999999, longitude: -5.84583400000002 }, Coordinate { latitude: 55.8825, longitude: -5.90416699999997 }, Coordinate { latitude: 55.8299940000001, longitude: -5.94694499999997 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.158051, longitude: -5.74250000000001 }, Coordinate { latitude: 56.159721, longitude: -5.74805600000002 }, Coordinate { latitude: 56.1627730000001, longitude: -5.75 }, Coordinate { latitude: 56.1691670000001, longitude: -5.744167 }, Coordinate { latitude: 56.1777730000001, longitude: -5.73555599999992 }, Coordinate { latitude: 56.194443, longitude: -5.69138899999996 }, Coordinate { latitude: 56.195549, longitude: -5.68555599999996 }, Coordinate { latitude: 56.1947170000001, longitude: -5.67972299999997 }, Coordinate { latitude: 56.19194, longitude: -5.67527899999999 }, Coordinate { latitude: 56.1891630000001, longitude: -5.67388899999997 }, Coordinate { latitude: 56.1849980000001, longitude: -5.67361199999999 }, Coordinate { latitude: 56.17305, longitude: -5.67361199999999 }, Coordinate { latitude: 56.1694410000001, longitude: -5.67583400000001 }, Coordinate { latitude: 56.16555, longitude: -5.68527799999998 }, Coordinate { latitude: 56.161385, longitude: -5.70249999999993 }, Coordinate { latitude: 56.1594390000001, longitude: -5.71333399999997 }, Coordinate { latitude: 56.158051, longitude: -5.73500100000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.186661, longitude: -5.63805600000001 }, Coordinate { latitude: 56.187775, longitude: -5.64416699999998 }, Coordinate { latitude: 56.18972, longitude: -5.64805599999994 }, Coordinate { latitude: 56.2124939999999, longitude: -5.66333400000002 }, Coordinate { latitude: 56.2158279999999, longitude: -5.665278 }, Coordinate { latitude: 56.2561039999999, longitude: -5.64416699999998 }, Coordinate { latitude: 56.2602770000001, longitude: -5.64194499999996 }, Coordinate { latitude: 56.2575, longitude: -5.60944499999994 }, Coordinate { latitude: 56.2544400000001, longitude: -5.60638899999998 }, Coordinate { latitude: 56.2500000000001, longitude: -5.60688299999998 }, Coordinate { latitude: 56.196938, longitude: -5.63 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.2672200000001, longitude: -5.62277799999993 }, Coordinate { latitude: 56.2680510000001, longitude: -5.63083399999999 }, Coordinate { latitude: 56.269997, longitude: -5.63555600000001 }, Coordinate { latitude: 56.293053, longitude: -5.64805599999994 }, Coordinate { latitude: 56.3011090000001, longitude: -5.64555599999994 }, Coordinate { latitude: 56.304443, longitude: -5.64333299999998 }, Coordinate { latitude: 56.316109, longitude: -5.63083399999999 }, Coordinate { latitude: 56.3208310000001, longitude: -5.62194499999993 }, Coordinate { latitude: 56.321106, longitude: -5.61444499999993 }, Coordinate { latitude: 56.321388, longitude: -5.58972299999999 }, Coordinate { latitude: 56.319717, longitude: -5.58388899999994 }, Coordinate { latitude: 56.3155520000001, longitude: -5.58361100000002 }, Coordinate { latitude: 56.3113860000001, longitude: -5.58527900000001 }, Coordinate { latitude: 56.27916, longitude: -5.60305599999998 }, Coordinate { latitude: 56.273331, longitude: -5.60861199999994 }, Coordinate { latitude: 56.268883, longitude: -5.61666699999995 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.301941, longitude: -6.41000099999997 }, Coordinate { latitude: 56.302216, longitude: -6.41833400000002 }, Coordinate { latitude: 56.3083270000001, longitude: -6.43305600000002 }, Coordinate { latitude: 56.3105550000001, longitude: -6.43638900000002 }, Coordinate { latitude: 56.3313830000001, longitude: -6.41638899999992 }, Coordinate { latitude: 56.3411100000001, longitude: -6.393889 }, Coordinate { latitude: 56.3422160000001, longitude: -6.38777800000003 }, Coordinate { latitude: 56.340828, longitude: -6.38194499999992 }, Coordinate { latitude: 56.337494, longitude: -6.38083399999994 }, Coordinate { latitude: 56.322777, longitude: -6.38916699999993 }, Coordinate { latitude: 56.3158260000001, longitude: -6.39333299999993 }, Coordinate { latitude: 56.3061070000001, longitude: -6.40111199999996 }, Coordinate { latitude: 56.3036040000001, longitude: -6.40472299999999 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.3780520000001, longitude: -5.55277799999999 }, Coordinate { latitude: 56.3822170000001, longitude: -5.58444500000002 }, Coordinate { latitude: 56.3849950000001, longitude: -5.58666699999992 }, Coordinate { latitude: 56.3891600000001, longitude: -5.58777800000001 }, Coordinate { latitude: 56.3922200000001, longitude: -5.58555599999994 }, Coordinate { latitude: 56.406105, longitude: -5.56777899999997 }, Coordinate { latitude: 56.409439, longitude: -5.54583400000001 }, Coordinate { latitude: 56.4111100000001, longitude: -5.50999999999993 }, Coordinate { latitude: 56.387772, longitude: -5.53638899999999 }, Coordinate { latitude: 56.382774, longitude: -5.54361199999994 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.4586110000001, longitude: -6.19889000000001 }, Coordinate { latitude: 56.464996, longitude: -6.23277899999994 }, Coordinate { latitude: 56.4661100000001, longitude: -6.23861099999999 }, Coordinate { latitude: 56.4777760000001, longitude: -6.25888899999995 }, Coordinate { latitude: 56.4819410000001, longitude: -6.25999999999993 }, Coordinate { latitude: 56.4855500000001, longitude: -6.25861200000003 }, Coordinate { latitude: 56.49472, longitude: -6.24166700000001 }, Coordinate { latitude: 56.4966660000001, longitude: -6.23666700000001 }, Coordinate { latitude: 56.4991610000001, longitude: -6.22472299999993 }, Coordinate { latitude: 56.4977720000001, longitude: -6.21555599999999 }, Coordinate { latitude: 56.49472, longitude: -6.20500099999998 }, Coordinate { latitude: 56.4752730000001, longitude: -6.162778 }, Coordinate { latitude: 56.4727710000001, longitude: -6.15972199999993 }, Coordinate { latitude: 56.4694440000001, longitude: -6.15777800000001 }, Coordinate { latitude: 56.4658280000001, longitude: -6.16055599999993 }, Coordinate { latitude: 56.4647220000001, longitude: -6.16583300000002 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.5141599999999, longitude: -6.75861200000003 }, Coordinate { latitude: 56.515831, longitude: -6.77416699999992 }, Coordinate { latitude: 56.515274, longitude: -6.78944499999994 }, Coordinate { latitude: 56.5147170000001, longitude: -6.79583399999996 }, Coordinate { latitude: 56.5130540000001, longitude: -6.80166700000001 }, Coordinate { latitude: 56.5113830000001, longitude: -6.80611099999993 }, Coordinate { latitude: 56.4749980000001, longitude: -6.87639000000001 }, Coordinate { latitude: 56.4688870000001, longitude: -6.88194499999992 }, Coordinate { latitude: 56.4386059999999, longitude: -6.89277800000002 }, Coordinate { latitude: 56.4399950000001, longitude: -6.92500000000001 }, Coordinate { latitude: 56.449165, longitude: -6.97222199999999 }, Coordinate { latitude: 56.4944380000001, longitude: -6.99083399999995 }, Coordinate { latitude: 56.4980550000001, longitude: -6.98861099999993 }, Coordinate { latitude: 56.5080490000001, longitude: -6.97333299999997 }, Coordinate { latitude: 56.5130540000001, longitude: -6.958056 }, Coordinate { latitude: 56.5483320000001, longitude: -6.76388899999995 }, Coordinate { latitude: 56.549164, longitude: -6.75805599999995 }, Coordinate { latitude: 56.5474930000001, longitude: -6.75250099999994 }, Coordinate { latitude: 56.542221, longitude: -6.74472199999997 }, Coordinate { latitude: 56.5308300000001, longitude: -6.73333400000001 }, Coordinate { latitude: 56.524437, longitude: -6.72916700000002 }, Coordinate { latitude: 56.520271, longitude: -6.72888899999992 }, Coordinate { latitude: 56.515831, longitude: -6.73916700000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.4788819999999, longitude: -5.71472299999999 }, Coordinate { latitude: 56.4511110000001, longitude: -5.65111199999996 }, Coordinate { latitude: 56.443886, longitude: -5.64888999999994 }, Coordinate { latitude: 56.4358290000001, longitude: -5.64833399999998 }, Coordinate { latitude: 56.4030530000001, longitude: -5.65861099999995 }, Coordinate { latitude: 56.3955540000001, longitude: -5.66305599999993 }, Coordinate { latitude: 56.3591610000001, longitude: -5.70194500000002 }, Coordinate { latitude: 56.3519440000001, longitude: -5.71472299999999 }, Coordinate { latitude: 56.3174969999999, longitude: -5.80861199999993 }, Coordinate { latitude: 56.308884, longitude: -5.84027899999995 }, Coordinate { latitude: 56.3080520000001, longitude: -5.84694499999995 }, Coordinate { latitude: 56.3105550000001, longitude: -5.86000100000001 }, Coordinate { latitude: 56.314163, longitude: -5.87194499999998 }, Coordinate { latitude: 56.3191600000001, longitude: -5.87805599999996 }, Coordinate { latitude: 56.325272, longitude: -5.87138899999997 }, Coordinate { latitude: 56.327217, longitude: -5.86583400000001 }, Coordinate { latitude: 56.3324970000001, longitude: -5.85972299999992 }, Coordinate { latitude: 56.3391650000001, longitude: -5.85388899999992 }, Coordinate { latitude: 56.342773, longitude: -5.85222199999993 }, Coordinate { latitude: 56.347771, longitude: -5.85250100000002 }, Coordinate { latitude: 56.349716, longitude: -5.85472299999992 }, Coordinate { latitude: 56.3519440000001, longitude: -5.86027799999999 }, Coordinate { latitude: 56.3524930000001, longitude: -5.86777799999999 }, Coordinate { latitude: 56.3519440000001, longitude: -5.88250099999993 }, Coordinate { latitude: 56.3491590000001, longitude: -5.89277800000002 }, Coordinate { latitude: 56.3186040000001, longitude: -5.98361199999999 }, Coordinate { latitude: 56.3047180000001, longitude: -6.01611100000002 }, Coordinate { latitude: 56.2588880000001, longitude: -6.26472299999995 }, Coordinate { latitude: 56.26416, longitude: -6.32111199999997 }, Coordinate { latitude: 56.266663, longitude: -6.32500099999999 }, Coordinate { latitude: 56.276382, longitude: -6.33944499999996 }, Coordinate { latitude: 56.281662, longitude: -6.34611100000001 }, Coordinate { latitude: 56.2844390000001, longitude: -6.34833300000003 }, Coordinate { latitude: 56.308884, longitude: -6.36611199999999 }, Coordinate { latitude: 56.313049, longitude: -6.36638899999997 }, Coordinate { latitude: 56.3299940000001, longitude: -6.36361099999999 }, Coordinate { latitude: 56.3369369999999, longitude: -6.350278 }, Coordinate { latitude: 56.3391650000001, longitude: -6.33944499999996 }, Coordinate { latitude: 56.340828, longitude: -6.29777799999994 }, Coordinate { latitude: 56.3399960000001, longitude: -6.29055599999998 }, Coordinate { latitude: 56.336105, longitude: -6.28166699999997 }, Coordinate { latitude: 56.3333280000001, longitude: -6.27805599999999 }, Coordinate { latitude: 56.3274990000001, longitude: -6.27194500000002 }, Coordinate { latitude: 56.3183290000001, longitude: -6.23194499999994 }, Coordinate { latitude: 56.3549960000001, longitude: -6.06583399999994 }, Coordinate { latitude: 56.3652730000001, longitude: -6.02722299999999 }, Coordinate { latitude: 56.367493, longitude: -6.022223 }, Coordinate { latitude: 56.3697200000001, longitude: -6.01861199999996 }, Coordinate { latitude: 56.3747180000001, longitude: -6.01777799999996 }, Coordinate { latitude: 56.378326, longitude: -6.01916699999998 }, Coordinate { latitude: 56.381104, longitude: -6.02194499999996 }, Coordinate { latitude: 56.382774, longitude: -6.02749999999998 }, Coordinate { latitude: 56.3822170000001, longitude: -6.03444499999995 }, Coordinate { latitude: 56.3711090000001, longitude: -6.07888899999995 }, Coordinate { latitude: 56.362778, longitude: -6.10472299999998 }, Coordinate { latitude: 56.3599930000001, longitude: -6.11583400000001 }, Coordinate { latitude: 56.3561100000001, longitude: -6.16916800000001 }, Coordinate { latitude: 56.3566670000001, longitude: -6.18499999999995 }, Coordinate { latitude: 56.361382, longitude: -6.19361099999992 }, Coordinate { latitude: 56.3677750000001, longitude: -6.19861100000003 }, Coordinate { latitude: 56.3780520000001, longitude: -6.203056 }, Coordinate { latitude: 56.3866650000001, longitude: -6.20027800000003 }, Coordinate { latitude: 56.428055, longitude: -6.14305599999994 }, Coordinate { latitude: 56.442772, longitude: -6.083056 }, Coordinate { latitude: 56.446106, longitude: -6.07166699999993 }, Coordinate { latitude: 56.459442, longitude: -6.03194499999995 }, Coordinate { latitude: 56.463333, longitude: -6.021389 }, Coordinate { latitude: 56.467499, longitude: -6.01277800000003 }, Coordinate { latitude: 56.474159, longitude: -6.00694499999992 }, Coordinate { latitude: 56.4777760000001, longitude: -6.00555600000001 }, Coordinate { latitude: 56.4899980000001, longitude: -6.00222300000002 }, Coordinate { latitude: 56.494164, longitude: -6.00277799999992 }, Coordinate { latitude: 56.496109, longitude: -6.00639000000001 }, Coordinate { latitude: 56.4965520000001, longitude: -6.01769100000001 }, Coordinate { latitude: 56.4811100000001, longitude: -6.09888899999999 }, Coordinate { latitude: 56.473328, longitude: -6.11805600000002 }, Coordinate { latitude: 56.4738850000001, longitude: -6.12639000000001 }, Coordinate { latitude: 56.4752730000001, longitude: -6.13194499999997 }, Coordinate { latitude: 56.5394439999999, longitude: -6.32527799999997 }, Coordinate { latitude: 56.5466610000001, longitude: -6.33777799999996 }, Coordinate { latitude: 56.599998, longitude: -6.32305600000001 }, Coordinate { latitude: 56.6030500000001, longitude: -6.32000099999999 }, Coordinate { latitude: 56.6430510000001, longitude: -6.18666699999994 }, Coordinate { latitude: 56.652771, longitude: -6.14055599999995 }, Coordinate { latitude: 56.6533280000001, longitude: -6.13388900000001 }, Coordinate { latitude: 56.650276, longitude: -6.11666700000001 }, Coordinate { latitude: 56.638885, longitude: -6.06888999999995 }, Coordinate { latitude: 56.6358260000001, longitude: -6.05694499999998 }, Coordinate { latitude: 56.622772, longitude: -6.03944499999994 }, Coordinate { latitude: 56.5833280000001, longitude: -5.99611199999993 }, Coordinate { latitude: 56.5799940000001, longitude: -5.99305599999997 }, Coordinate { latitude: 56.5508270000001, longitude: -5.974445 }, Coordinate { latitude: 56.5444410000001, longitude: -5.97111100000001 }, Coordinate { latitude: 56.519165, longitude: -5.85638899999992 }, Coordinate { latitude: 56.513611, longitude: -5.80055599999997 }, Coordinate { latitude: 56.512772, longitude: -5.79388899999998 }, Coordinate { latitude: 56.508888, longitude: -5.78361100000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.55555, longitude: -6.67833399999995 }, Coordinate { latitude: 56.5566640000001, longitude: -6.68583399999994 }, Coordinate { latitude: 56.569443, longitude: -6.69444499999992 }, Coordinate { latitude: 56.5799940000001, longitude: -6.69889000000001 }, Coordinate { latitude: 56.5833280000001, longitude: -6.69611200000003 }, Coordinate { latitude: 56.6344379999999, longitude: -6.61389000000003 }, Coordinate { latitude: 56.6533280000001, longitude: -6.57389000000001 }, Coordinate { latitude: 56.6661070000001, longitude: -6.54583400000001 }, Coordinate { latitude: 56.68222, longitude: -6.50972300000001 }, Coordinate { latitude: 56.683884, longitude: -6.50472300000001 }, Coordinate { latitude: 56.687218, longitude: -6.49333399999995 }, Coordinate { latitude: 56.6888890000001, longitude: -6.46555599999999 }, Coordinate { latitude: 56.689163, longitude: -6.45722299999994 }, Coordinate { latitude: 56.686104, longitude: -6.45444500000002 }, Coordinate { latitude: 56.682495, longitude: -6.45305599999995 }, Coordinate { latitude: 56.678886, longitude: -6.45444500000002 }, Coordinate { latitude: 56.6386110000001, longitude: -6.48500099999995 }, Coordinate { latitude: 56.6299970000001, longitude: -6.49333399999995 }, Coordinate { latitude: 56.624992, longitude: -6.50139000000001 }, Coordinate { latitude: 56.5855480000001, longitude: -6.57444500000003 }, Coordinate { latitude: 56.5833280000001, longitude: -6.578889 }, Coordinate { latitude: 56.5799940000001, longitude: -6.58916799999997 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.869164, longitude: -6.15916700000002 }, Coordinate { latitude: 56.8730550000001, longitude: -6.17805599999997 }, Coordinate { latitude: 56.887215, longitude: -6.21138999999999 }, Coordinate { latitude: 56.890549, longitude: -6.21361199999996 }, Coordinate { latitude: 56.898888, longitude: -6.21444499999996 }, Coordinate { latitude: 56.903053, longitude: -6.21472299999999 }, Coordinate { latitude: 56.9069440000001, longitude: -6.21305599999999 }, Coordinate { latitude: 56.91333, longitude: -6.20749999999998 }, Coordinate { latitude: 56.9408260000001, longitude: -6.15861100000001 }, Coordinate { latitude: 56.9450000000001, longitude: -6.14972299999994 }, Coordinate { latitude: 56.943054, longitude: -6.13750099999999 }, Coordinate { latitude: 56.9324950000001, longitude: -6.11361099999993 }, Coordinate { latitude: 56.9269409999999, longitude: -6.10749999999996 }, Coordinate { latitude: 56.921104, longitude: -6.10805599999998 }, Coordinate { latitude: 56.895554, longitude: -6.11472200000003 }, Coordinate { latitude: 56.8838880000001, longitude: -6.11972200000002 }, Coordinate { latitude: 56.8811040000001, longitude: -6.123334 }, Coordinate { latitude: 56.871384, longitude: -6.13888899999995 }, Coordinate { latitude: 56.869995, longitude: -6.14472299999994 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.934166, longitude: -6.32555600000001 }, Coordinate { latitude: 56.935555, longitude: -6.33055599999994 }, Coordinate { latitude: 56.946388, longitude: -6.36194499999999 }, Coordinate { latitude: 56.998886, longitude: -6.44833399999999 }, Coordinate { latitude: 57.0022200000001, longitude: -6.45222299999995 }, Coordinate { latitude: 57.006104, longitude: -6.45166699999993 }, Coordinate { latitude: 57.0327760000001, longitude: -6.41555599999992 }, Coordinate { latitude: 57.043884, longitude: -6.39333299999993 }, Coordinate { latitude: 57.04805, longitude: -6.38416699999993 }, Coordinate { latitude: 57.053055, longitude: -6.34750100000002 }, Coordinate { latitude: 57.054161, longitude: -6.32611199999997 }, Coordinate { latitude: 57.043327, longitude: -6.27722299999999 }, Coordinate { latitude: 57.041664, longitude: -6.27055599999994 }, Coordinate { latitude: 57.037773, longitude: -6.26166699999993 }, Coordinate { latitude: 57.031944, longitude: -6.25416799999999 }, Coordinate { latitude: 57.0258330000001, longitude: -6.24972199999996 }, Coordinate { latitude: 57.022217, longitude: -6.249167 }, Coordinate { latitude: 56.995552, longitude: -6.2475 }, Coordinate { latitude: 56.964165, longitude: -6.255 }, Coordinate { latitude: 56.9605480000001, longitude: -6.25694499999997 }, Coordinate { latitude: 56.9516600000001, longitude: -6.26666699999993 }, Coordinate { latitude: 56.944443, longitude: -6.27833399999992 }, Coordinate { latitude: 56.9372180000001, longitude: -6.29861199999993 }, Coordinate { latitude: 56.934441, longitude: -6.31055600000002 }, Coordinate { latitude: 56.934166, longitude: -6.3175 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 56.9408260000001, longitude: -7.47527799999995 }, Coordinate { latitude: 56.943054, longitude: -7.51527799999997 }, Coordinate { latitude: 56.94416, longitude: -7.53055599999993 }, Coordinate { latitude: 56.9474950000001, longitude: -7.55027899999999 }, Coordinate { latitude: 56.9513850000001, longitude: -7.55944499999993 }, Coordinate { latitude: 56.955551, longitude: -7.56055600000002 }, Coordinate { latitude: 56.9602740000001, longitude: -7.55999999999995 }, Coordinate { latitude: 56.9663850000001, longitude: -7.55361199999999 }, Coordinate { latitude: 57.05555, longitude: -7.44555599999995 }, Coordinate { latitude: 57.0544430000001, longitude: -7.43972299999996 }, Coordinate { latitude: 57.043884, longitude: -7.418612 }, Coordinate { latitude: 57.041382, longitude: -7.41472199999993 }, Coordinate { latitude: 56.9822160000001, longitude: -7.37805600000002 }, Coordinate { latitude: 56.978607, longitude: -7.37611199999992 }, Coordinate { latitude: 56.9450000000001, longitude: -7.43472299999996 }, Coordinate { latitude: 56.9427720000001, longitude: -7.43916699999994 }, Coordinate { latitude: 56.9408260000001, longitude: -7.46694500000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.043884, longitude: -6.58111200000002 }, Coordinate { latitude: 57.046387, longitude: -6.60250099999996 }, Coordinate { latitude: 57.0511090000001, longitude: -6.60138899999998 }, Coordinate { latitude: 57.0549930000001, longitude: -6.59333399999997 }, Coordinate { latitude: 57.066383, longitude: -6.55555599999997 }, Coordinate { latitude: 57.0680540000001, longitude: -6.54944499999999 }, Coordinate { latitude: 57.067497, longitude: -6.543612 }, Coordinate { latitude: 57.062218, longitude: -6.49972200000002 }, Coordinate { latitude: 57.0605550000001, longitude: -6.49416699999995 }, Coordinate { latitude: 57.05722, longitude: -6.49194499999993 }, Coordinate { latitude: 57.054161, longitude: -6.49500099999995 }, Coordinate { latitude: 57.052216, longitude: -6.49916699999994 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.2777710000001, longitude: -5.94611199999997 }, Coordinate { latitude: 57.2799990000001, longitude: -5.96888899999993 }, Coordinate { latitude: 57.282776, longitude: -5.980278 }, Coordinate { latitude: 57.28833, longitude: -5.99638900000002 }, Coordinate { latitude: 57.295273, longitude: -6.00833399999999 }, Coordinate { latitude: 57.3033290000001, longitude: -6.018056 }, Coordinate { latitude: 57.307777, longitude: -6.01916699999998 }, Coordinate { latitude: 57.3116610000001, longitude: -6.01777799999996 }, Coordinate { latitude: 57.314438, longitude: -6.01499999999999 }, Coordinate { latitude: 57.3186040000001, longitude: -6.00583399999994 }, Coordinate { latitude: 57.320549, longitude: -5.98777899999999 }, Coordinate { latitude: 57.3186040000001, longitude: -5.95666699999998 }, Coordinate { latitude: 57.317215, longitude: -5.95027799999997 }, Coordinate { latitude: 57.3116610000001, longitude: -5.93388900000002 }, Coordinate { latitude: 57.309715, longitude: -5.93000000000001 }, Coordinate { latitude: 57.3011090000001, longitude: -5.92083399999996 }, Coordinate { latitude: 57.2977750000001, longitude: -5.91861199999994 }, Coordinate { latitude: 57.294167, longitude: -5.91777799999994 }, Coordinate { latitude: 57.289444, longitude: -5.91833399999996 }, Coordinate { latitude: 57.2833330000001, longitude: -5.92333400000001 }, Coordinate { latitude: 57.2808299999999, longitude: -5.92805600000003 }, Coordinate { latitude: 57.2780530000001, longitude: -5.939167 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.332771, longitude: -7.231112 }, Coordinate { latitude: 57.3277740000001, longitude: -7.24611199999998 }, Coordinate { latitude: 57.3266600000001, longitude: -7.25222299999996 }, Coordinate { latitude: 57.327217, longitude: -7.25888900000001 }, Coordinate { latitude: 57.336105, longitude: -7.28527799999995 }, Coordinate { latitude: 57.3224950000001, longitude: -7.28805599999998 }, Coordinate { latitude: 57.152496, longitude: -7.25916699999993 }, Coordinate { latitude: 57.114441, longitude: -7.21472299999994 }, Coordinate { latitude: 57.1102750000001, longitude: -7.21527899999995 }, Coordinate { latitude: 57.0969390000001, longitude: -7.22583400000002 }, Coordinate { latitude: 57.0947190000001, longitude: -7.230278 }, Coordinate { latitude: 57.1036070000001, longitude: -7.265556 }, Coordinate { latitude: 57.1061100000001, longitude: -7.28722299999998 }, Coordinate { latitude: 57.1061100000001, longitude: -7.30333400000001 }, Coordinate { latitude: 57.0999980000001, longitude: -7.33361100000002 }, Coordinate { latitude: 57.0991589999999, longitude: -7.356112 }, Coordinate { latitude: 57.0999980000001, longitude: -7.36305599999997 }, Coordinate { latitude: 57.108604, longitude: -7.38139000000001 }, Coordinate { latitude: 57.114716, longitude: -7.38666699999999 }, Coordinate { latitude: 57.1249920000001, longitude: -7.39250099999998 }, Coordinate { latitude: 57.131943, longitude: -7.39611099999996 }, Coordinate { latitude: 57.1824950000001, longitude: -7.41750000000002 }, Coordinate { latitude: 57.186661, longitude: -7.41888899999992 }, Coordinate { latitude: 57.21833, longitude: -7.42083400000001 }, Coordinate { latitude: 57.3822170000001, longitude: -7.42500000000001 }, Coordinate { latitude: 57.385277, longitude: -7.42222299999992 }, Coordinate { latitude: 57.3897170000001, longitude: -7.41222299999993 }, Coordinate { latitude: 57.401382, longitude: -7.36805600000002 }, Coordinate { latitude: 57.3958280000001, longitude: -7.33555599999994 }, Coordinate { latitude: 57.381104, longitude: -7.28583299999997 }, Coordinate { latitude: 57.375275, longitude: -7.27194500000002 }, Coordinate { latitude: 57.3722150000001, longitude: -7.267222 }, Coordinate { latitude: 57.3416600000001, longitude: -7.224445 }, Coordinate { latitude: 57.337494, longitude: -7.22305599999993 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.3974990000001, longitude: -7.28333399999997 }, Coordinate { latitude: 57.3997190000001, longitude: -7.31361199999998 }, Coordinate { latitude: 57.401382, longitude: -7.32027799999997 }, Coordinate { latitude: 57.4202730000001, longitude: -7.37805600000002 }, Coordinate { latitude: 57.423882, longitude: -7.38805600000001 }, Coordinate { latitude: 57.4419400000001, longitude: -7.40472299999993 }, Coordinate { latitude: 57.448326, longitude: -7.40944499999995 }, Coordinate { latitude: 57.4522170000001, longitude: -7.41000100000002 }, Coordinate { latitude: 57.4641649999999, longitude: -7.40638899999993 }, Coordinate { latitude: 57.467773, longitude: -7.40416699999997 }, Coordinate { latitude: 57.470276, longitude: -7.40027799999996 }, Coordinate { latitude: 57.488327, longitude: -7.35777899999999 }, Coordinate { latitude: 57.489441, longitude: -7.351111 }, Coordinate { latitude: 57.483604, longitude: -7.30055600000003 }, Coordinate { latitude: 57.480553, longitude: -7.27611200000001 }, Coordinate { latitude: 57.4763870000001, longitude: -7.24416699999995 }, Coordinate { latitude: 57.460831, longitude: -7.204722 }, Coordinate { latitude: 57.457497, longitude: -7.20249999999999 }, Coordinate { latitude: 57.418884, longitude: -7.202223 }, Coordinate { latitude: 57.414993, longitude: -7.20444499999996 }, Coordinate { latitude: 57.40361, longitude: -7.23944499999999 }, Coordinate { latitude: 57.4022220000001, longitude: -7.24472199999997 }, Coordinate { latitude: 57.3988880000001, longitude: -7.268889 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.3244400000001, longitude: -6.05111099999999 }, Coordinate { latitude: 57.324715, longitude: -6.06027799999998 }, Coordinate { latitude: 57.3263850000001, longitude: -6.06611199999998 }, Coordinate { latitude: 57.3291630000001, longitude: -6.06833399999994 }, Coordinate { latitude: 57.3488849999999, longitude: -6.07944500000002 }, Coordinate { latitude: 57.3530499999999, longitude: -6.07972199999995 }, Coordinate { latitude: 57.3941650000001, longitude: -6.07833399999993 }, Coordinate { latitude: 57.43055, longitude: -6.07305599999995 }, Coordinate { latitude: 57.4511110000001, longitude: -6.06527799999998 }, Coordinate { latitude: 57.4547200000001, longitude: -6.06361199999998 }, Coordinate { latitude: 57.491943, longitude: -6.03166700000003 }, Coordinate { latitude: 57.4944380000001, longitude: -6.02777899999995 }, Coordinate { latitude: 57.5086059999999, longitude: -6.00305600000002 }, Coordinate { latitude: 57.4958270000001, longitude: -5.98000000000002 }, Coordinate { latitude: 57.4924930000001, longitude: -5.976945 }, Coordinate { latitude: 57.488327, longitude: -5.97666700000002 }, Coordinate { latitude: 57.349998, longitude: -5.99000099999995 }, Coordinate { latitude: 57.342773, longitude: -5.99444499999993 }, Coordinate { latitude: 57.3397219999999, longitude: -5.99722300000002 }, Coordinate { latitude: 57.334999, longitude: -6.00639000000001 }, Coordinate { latitude: 57.328606, longitude: -6.02694499999996 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.5152740000001, longitude: -5.97138999999999 }, Coordinate { latitude: 57.515831, longitude: -5.97833300000002 }, Coordinate { latitude: 57.5241620000001, longitude: -5.98888999999997 }, Coordinate { latitude: 57.5277710000001, longitude: -5.99027799999999 }, Coordinate { latitude: 57.5408330000001, longitude: -5.99083399999995 }, Coordinate { latitude: 57.562492, longitude: -5.98222299999998 }, Coordinate { latitude: 57.572777, longitude: -5.96638999999993 }, Coordinate { latitude: 57.5749969999999, longitude: -5.96166699999992 }, Coordinate { latitude: 57.573883, longitude: -5.95583299999998 }, Coordinate { latitude: 57.570549, longitude: -5.95388899999995 }, Coordinate { latitude: 57.567215, longitude: -5.95333399999998 }, Coordinate { latitude: 57.522774, longitude: -5.96777800000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.4844440000001, longitude: -6.13666699999999 }, Coordinate { latitude: 57.419167, longitude: -6.14666699999998 }, Coordinate { latitude: 57.40416, longitude: -6.14777899999996 }, Coordinate { latitude: 57.313049, longitude: -6.13472300000001 }, Coordinate { latitude: 57.3061070000001, longitude: -6.12722300000002 }, Coordinate { latitude: 57.2419430000001, longitude: -5.89916699999992 }, Coordinate { latitude: 57.239166, longitude: -5.88666699999993 }, Coordinate { latitude: 57.2399980000001, longitude: -5.87999999999994 }, Coordinate { latitude: 57.2536090000001, longitude: -5.83333399999998 }, Coordinate { latitude: 57.272217, longitude: -5.76888899999994 }, Coordinate { latitude: 57.276108, longitude: -5.75055600000002 }, Coordinate { latitude: 57.275833, longitude: -5.74305600000002 }, Coordinate { latitude: 57.259995, longitude: -5.64916699999998 }, Coordinate { latitude: 57.2566600000001, longitude: -5.64611099999996 }, Coordinate { latitude: 57.2091600000001, longitude: -5.66138899999993 }, Coordinate { latitude: 57.2049940000001, longitude: -5.66388899999993 }, Coordinate { latitude: 57.1997150000001, longitude: -5.67027899999999 }, Coordinate { latitude: 57.116661, longitude: -5.80361199999993 }, Coordinate { latitude: 57.1102750000001, longitude: -5.81638900000002 }, Coordinate { latitude: 57.1066670000001, longitude: -5.82694499999997 }, Coordinate { latitude: 57.105553, longitude: -5.833056 }, Coordinate { latitude: 57.10527, longitude: -5.84750100000002 }, Coordinate { latitude: 57.092773, longitude: -5.85916700000001 }, Coordinate { latitude: 57.0638890000001, longitude: -5.88916699999993 }, Coordinate { latitude: 57.0611040000001, longitude: -5.893056 }, Coordinate { latitude: 57.0386050000001, longitude: -5.92805600000003 }, Coordinate { latitude: 57.035553, longitude: -5.93944499999998 }, Coordinate { latitude: 57.0269390000001, longitude: -5.98000000000002 }, Coordinate { latitude: 57.0236049999999, longitude: -5.99833399999994 }, Coordinate { latitude: 57.022217, longitude: -6.01194500000003 }, Coordinate { latitude: 57.0247190000001, longitude: -6.01666699999998 }, Coordinate { latitude: 57.0477750000001, longitude: -6.03222299999993 }, Coordinate { latitude: 57.0547179999999, longitude: -6.03472199999993 }, Coordinate { latitude: 57.0583270000001, longitude: -6.03333400000002 }, Coordinate { latitude: 57.1116640000001, longitude: -5.99083399999995 }, Coordinate { latitude: 57.1302719999999, longitude: -5.97416700000002 }, Coordinate { latitude: 57.177498, longitude: -6.03055599999993 }, Coordinate { latitude: 57.126389, longitude: -6.07361100000003 }, Coordinate { latitude: 57.1241610000001, longitude: -6.07722299999995 }, Coordinate { latitude: 57.1249920000001, longitude: -6.085556 }, Coordinate { latitude: 57.1283260000001, longitude: -6.09666699999997 }, Coordinate { latitude: 57.170555, longitude: -6.17666699999995 }, Coordinate { latitude: 57.157494, longitude: -6.31444499999992 }, Coordinate { latitude: 57.1594390000001, longitude: -6.31833399999999 }, Coordinate { latitude: 57.263329, longitude: -6.44694499999997 }, Coordinate { latitude: 57.2694400000001, longitude: -6.45249999999993 }, Coordinate { latitude: 57.299721, longitude: -6.47916699999996 }, Coordinate { latitude: 57.303055, longitude: -6.48138899999998 }, Coordinate { latitude: 57.307495, longitude: -6.48083399999996 }, Coordinate { latitude: 57.332771, longitude: -6.42611099999993 }, Coordinate { latitude: 57.3347170000001, longitude: -6.42166700000001 }, Coordinate { latitude: 57.334999, longitude: -6.41305599999998 }, Coordinate { latitude: 57.328606, longitude: -6.39833399999998 }, Coordinate { latitude: 57.314438, longitude: -6.37388899999996 }, Coordinate { latitude: 57.302216, longitude: -6.34583400000002 }, Coordinate { latitude: 57.298332, longitude: -6.33527899999996 }, Coordinate { latitude: 57.297218, longitude: -6.32944499999996 }, Coordinate { latitude: 57.297493, longitude: -6.314167 }, Coordinate { latitude: 57.2999950000001, longitude: -6.31027799999993 }, Coordinate { latitude: 57.304161, longitude: -6.30972300000002 }, Coordinate { latitude: 57.4066620000001, longitude: -6.52694499999996 }, Coordinate { latitude: 57.408333, longitude: -6.53333400000002 }, Coordinate { latitude: 57.3841629999999, longitude: -6.57361100000003 }, Coordinate { latitude: 57.3758320000001, longitude: -6.57361100000003 }, Coordinate { latitude: 57.3538820000001, longitude: -6.56444499999998 }, Coordinate { latitude: 57.3502730000001, longitude: -6.56333399999994 }, Coordinate { latitude: 57.345551, longitude: -6.56361199999998 }, Coordinate { latitude: 57.337494, longitude: -6.56722299999996 }, Coordinate { latitude: 57.334999, longitude: -6.57000099999993 }, Coordinate { latitude: 57.3333280000001, longitude: -6.57555600000001 }, Coordinate { latitude: 57.333885, longitude: -6.58277800000002 }, Coordinate { latitude: 57.344162, longitude: -6.625 }, Coordinate { latitude: 57.3608320000001, longitude: -6.68916699999994 }, Coordinate { latitude: 57.363884, longitude: -6.70000099999999 }, Coordinate { latitude: 57.3680500000001, longitude: -6.709723 }, Coordinate { latitude: 57.376106, longitude: -6.72083400000002 }, Coordinate { latitude: 57.37944, longitude: -6.72277799999995 }, Coordinate { latitude: 57.3872150000001, longitude: -6.72472299999993 }, Coordinate { latitude: 57.40361, longitude: -6.72444499999995 }, Coordinate { latitude: 57.4277729999999, longitude: -6.77277900000001 }, Coordinate { latitude: 57.4302750000001, longitude: -6.77666799999997 }, Coordinate { latitude: 57.4330519999999, longitude: -6.77888999999999 }, Coordinate { latitude: 57.446106, longitude: -6.78583299999997 }, Coordinate { latitude: 57.4499970000001, longitude: -6.78472199999999 }, Coordinate { latitude: 57.492775, longitude: -6.7475 }, Coordinate { latitude: 57.605553, longitude: -6.63750099999999 }, Coordinate { latitude: 57.605827, longitude: -6.62277799999998 }, Coordinate { latitude: 57.604721, longitude: -6.61583400000001 }, Coordinate { latitude: 57.600555, longitude: -6.60722299999992 }, Coordinate { latitude: 57.5886080000001, longitude: -6.58638999999999 }, Coordinate { latitude: 57.5830540000001, longitude: -6.57833399999993 }, Coordinate { latitude: 57.577774, longitude: -6.57222300000001 }, Coordinate { latitude: 57.568329, longitude: -6.56555599999996 }, Coordinate { latitude: 57.555832, longitude: -6.56444499999998 }, Coordinate { latitude: 57.5522159999999, longitude: -6.56333399999994 }, Coordinate { latitude: 57.5463870000001, longitude: -6.55722199999997 }, Coordinate { latitude: 57.508888, longitude: -6.46333399999992 }, Coordinate { latitude: 57.5049970000001, longitude: -6.43000000000001 }, Coordinate { latitude: 57.5241620000001, longitude: -6.37555599999996 }, Coordinate { latitude: 57.602776, longitude: -6.39583399999998 }, Coordinate { latitude: 57.63472, longitude: -6.42027899999994 }, Coordinate { latitude: 57.6374970000001, longitude: -6.42138999999992 }, Coordinate { latitude: 57.6419370000001, longitude: -6.41916800000001 }, Coordinate { latitude: 57.6488880000001, longitude: -6.40722299999999 }, Coordinate { latitude: 57.684715, longitude: -6.34555599999993 }, Coordinate { latitude: 57.686104, longitude: -6.30416699999995 }, Coordinate { latitude: 57.672218, longitude: -6.27694500000001 }, Coordinate { latitude: 57.6144410000001, longitude: -6.18138999999996 }, Coordinate { latitude: 57.6086040000001, longitude: -6.17444499999999 }, Coordinate { latitude: 57.5972210000001, longitude: -6.16305599999993 }, Coordinate { latitude: 57.59111, longitude: -6.15805599999993 }, Coordinate { latitude: 57.5749969999999, longitude: -6.14611099999996 }, Coordinate { latitude: 57.5680540000001, longitude: -6.14388899999994 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.6422200000001, longitude: -7.07527800000003 }, Coordinate { latitude: 57.6374970000001, longitude: -7.06749999999994 }, Coordinate { latitude: 57.633331, longitude: -7.06583399999994 }, Coordinate { latitude: 57.5149990000001, longitude: -7.14749999999992 }, Coordinate { latitude: 57.509438, longitude: -7.15388999999999 }, Coordinate { latitude: 57.508049, longitude: -7.16833399999996 }, Coordinate { latitude: 57.503609, longitude: -7.23361199999999 }, Coordinate { latitude: 57.5041660000001, longitude: -7.31472299999996 }, Coordinate { latitude: 57.505272, longitude: -7.32138899999995 }, Coordinate { latitude: 57.507774, longitude: -7.32611199999997 }, Coordinate { latitude: 57.5274960000001, longitude: -7.32749999999999 }, Coordinate { latitude: 57.5441670000001, longitude: -7.32527799999997 }, Coordinate { latitude: 57.5508270000001, longitude: -7.34777800000001 }, Coordinate { latitude: 57.5680540000001, longitude: -7.41166700000002 }, Coordinate { latitude: 57.5638890000001, longitude: -7.455556 }, Coordinate { latitude: 57.5619430000001, longitude: -7.46777800000001 }, Coordinate { latitude: 57.562492, longitude: -7.47694499999994 }, Coordinate { latitude: 57.566109, longitude: -7.48611199999993 }, Coordinate { latitude: 57.586105, longitude: -7.53638899999999 }, Coordinate { latitude: 57.588051, longitude: -7.540278 }, Coordinate { latitude: 57.5908280000001, longitude: -7.54333399999996 }, Coordinate { latitude: 57.5955510000001, longitude: -7.54333399999996 }, Coordinate { latitude: 57.6463850000001, longitude: -7.49138900000003 }, Coordinate { latitude: 57.6519390000001, longitude: -7.48388999999992 }, Coordinate { latitude: 57.6549989999999, longitude: -7.47277799999995 }, Coordinate { latitude: 57.653328, longitude: -7.432501 }, Coordinate { latitude: 57.6563870000001, longitude: -7.27500099999997 }, Coordinate { latitude: 57.6594390000001, longitude: -7.27111100000002 }, Coordinate { latitude: 57.676941, longitude: -7.24472199999997 }, Coordinate { latitude: 57.686943, longitude: -7.19722300000001 }, Coordinate { latitude: 57.6872180000001, longitude: -7.18861199999992 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.701942, longitude: -7.20444499999996 }, Coordinate { latitude: 57.703331, longitude: -7.21972299999993 }, Coordinate { latitude: 57.707771, longitude: -7.21916700000003 }, Coordinate { latitude: 57.713608, longitude: -7.21277799999996 }, Coordinate { latitude: 57.724716, longitude: -7.19861099999997 }, Coordinate { latitude: 57.7288820000001, longitude: -7.18972300000002 }, Coordinate { latitude: 57.733604, longitude: -7.17388899999997 }, Coordinate { latitude: 57.7347179999999, longitude: -7.16666699999996 }, Coordinate { latitude: 57.734161, longitude: -7.16000099999997 }, Coordinate { latitude: 57.7236100000001, longitude: -7.14472299999994 }, Coordinate { latitude: 57.718887, longitude: -7.14527800000002 }, Coordinate { latitude: 57.7166600000001, longitude: -7.15000099999992 }, Coordinate { latitude: 57.7149960000001, longitude: -7.15500100000003 }, Coordinate { latitude: 57.702217, longitude: -7.19666699999999 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.7986070000001, longitude: -8.57555600000001 }, Coordinate { latitude: 57.7988820000001, longitude: -8.58249999999998 }, Coordinate { latitude: 57.804718, longitude: -8.606112 }, Coordinate { latitude: 57.806389, longitude: -8.61194599999999 }, Coordinate { latitude: 57.8227770000001, longitude: -8.62138899999997 }, Coordinate { latitude: 57.8261110000001, longitude: -8.61861199999998 }, Coordinate { latitude: 57.8238830000001, longitude: -8.58361199999996 }, Coordinate { latitude: 57.819717, longitude: -8.56555600000002 }, Coordinate { latitude: 57.8161090000001, longitude: -8.55472400000002 }, Coordinate { latitude: 57.8138890000001, longitude: -8.55222300000003 }, Coordinate { latitude: 57.8108290000001, longitude: -8.55527899999993 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 57.877777, longitude: -7.07361100000003 }, Coordinate { latitude: 57.8799969999999, longitude: -7.07777800000002 }, Coordinate { latitude: 57.892776, longitude: -7.07666699999993 }, Coordinate { latitude: 57.8961110000001, longitude: -7.07361100000003 }, Coordinate { latitude: 57.91555, longitude: -7.03277800000001 }, Coordinate { latitude: 57.916939, longitude: -7.02749999999998 }, Coordinate { latitude: 57.9197160000001, longitude: -7.00722300000001 }, Coordinate { latitude: 57.9199980000001, longitude: -6.99944499999992 }, Coordinate { latitude: 57.9186100000001, longitude: -6.99361099999993 }, Coordinate { latitude: 57.913887, longitude: -6.994167 }, Coordinate { latitude: 57.890831, longitude: -6.9975 }, Coordinate { latitude: 57.887215, longitude: -6.99888900000002 }, Coordinate { latitude: 57.8813860000001, longitude: -7.00639000000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 58.2019420000001, longitude: -6.83888899999994 }, Coordinate { latitude: 58.203888, longitude: -6.86916699999995 }, Coordinate { latitude: 58.206383, longitude: -6.87305600000002 }, Coordinate { latitude: 58.2444380000001, longitude: -6.88888900000001 }, Coordinate { latitude: 58.248604, longitude: -6.88999999999999 }, Coordinate { latitude: 58.2524950000001, longitude: -6.889723 }, Coordinate { latitude: 58.2541659999999, longitude: -6.88166699999994 }, Coordinate { latitude: 58.2511060000001, longitude: -6.86027799999999 }, Coordinate { latitude: 58.2500000000001, longitude: -6.85416700000002 }, Coordinate { latitude: 58.2286070000001, longitude: -6.80972300000002 }, Coordinate { latitude: 58.2180480000001, longitude: -6.79444499999994 }, Coordinate { latitude: 58.2069400000001, longitude: -6.79138899999998 }, Coordinate { latitude: 58.2033310000001, longitude: -6.79444499999994 }, Coordinate { latitude: 58.203049, longitude: -6.80222200000003 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 58.3177720000001, longitude: -6.23250000000002 }, Coordinate { latitude: 58.2877730000001, longitude: -6.27972299999999 }, Coordinate { latitude: 58.263611, longitude: -6.32389000000001 }, Coordinate { latitude: 58.237938, longitude: -6.32827799999995 }, Coordinate { latitude: 58.235439, longitude: -6.32844499999993 }, Coordinate { latitude: 58.23344, longitude: -6.32761099999993 }, Coordinate { latitude: 58.2317730000001, longitude: -6.32527799999997 }, Coordinate { latitude: 58.230774, longitude: -6.32177799999994 }, Coordinate { latitude: 58.2229390000001, longitude: -6.28511099999992 }, Coordinate { latitude: 58.2222750000001, longitude: -6.28127899999998 }, Coordinate { latitude: 58.2227750000001, longitude: -6.27694500000001 }, Coordinate { latitude: 58.2236060000001, longitude: -6.27361200000001 }, Coordinate { latitude: 58.227444, longitude: -6.265445 }, Coordinate { latitude: 58.2336040000001, longitude: -6.22083399999997 }, Coordinate { latitude: 58.2408290000001, longitude: -6.20861100000002 }, Coordinate { latitude: 58.2583309999999, longitude: -6.17250099999995 }, Coordinate { latitude: 58.2605510000001, longitude: -6.167778 }, Coordinate { latitude: 58.2597200000001, longitude: -6.16000100000002 }, Coordinate { latitude: 58.2561040000001, longitude: -6.14805599999994 }, Coordinate { latitude: 58.252777, longitude: -6.14694499999996 }, Coordinate { latitude: 58.21833, longitude: -6.15833400000002 }, Coordinate { latitude: 58.2122190000001, longitude: -6.164445 }, Coordinate { latitude: 58.2069400000001, longitude: -6.17222299999997 }, Coordinate { latitude: 58.183609, longitude: -6.22472299999993 }, Coordinate { latitude: 58.176609, longitude: -6.263778 }, Coordinate { latitude: 58.1827740000001, longitude: -6.32911099999995 }, Coordinate { latitude: 58.1586070000001, longitude: -6.36666699999995 }, Coordinate { latitude: 58.1355510000001, longitude: -6.37472199999996 }, Coordinate { latitude: 58.131943, longitude: -6.37694499999998 }, Coordinate { latitude: 58.129715, longitude: -6.38222300000001 }, Coordinate { latitude: 58.097496, longitude: -6.49722300000002 }, Coordinate { latitude: 58.091942, longitude: -6.54805599999992 }, Coordinate { latitude: 58.084999, longitude: -6.60111099999995 }, Coordinate { latitude: 58.08194, longitude: -6.62027799999993 }, Coordinate { latitude: 58.078331, longitude: -6.619167 }, Coordinate { latitude: 58.078331, longitude: -6.59472299999999 }, Coordinate { latitude: 58.087494, longitude: -6.49694499999993 }, Coordinate { latitude: 58.102219, longitude: -6.42027899999994 }, Coordinate { latitude: 58.105553, longitude: -6.41027799999995 }, Coordinate { latitude: 58.1058270000001, longitude: -6.40249999999998 }, Coordinate { latitude: 58.104721, longitude: -6.39611100000002 }, Coordinate { latitude: 58.09861, longitude: -6.390556 }, Coordinate { latitude: 58.0330510000001, longitude: -6.35388899999992 }, Coordinate { latitude: 58.029999, longitude: -6.35666800000001 }, Coordinate { latitude: 58.0091630000001, longitude: -6.38611100000003 }, Coordinate { latitude: 57.9680480000001, longitude: -6.45777800000002 }, Coordinate { latitude: 57.9483260000001, longitude: -6.47388899999999 }, Coordinate { latitude: 57.94416, longitude: -6.47277800000001 }, Coordinate { latitude: 57.9402770000001, longitude: -6.47388899999999 }, Coordinate { latitude: 57.9163820000001, longitude: -6.53805599999993 }, Coordinate { latitude: 57.9149930000001, longitude: -6.54416800000001 }, Coordinate { latitude: 57.911385, longitude: -6.57055599999995 }, Coordinate { latitude: 57.9108280000001, longitude: -6.57749999999993 }, Coordinate { latitude: 57.9144440000001, longitude: -6.62111199999998 }, Coordinate { latitude: 57.9152760000001, longitude: -6.62805600000002 }, Coordinate { latitude: 57.9199980000001, longitude: -6.65305599999994 }, Coordinate { latitude: 57.924164, longitude: -6.66222299999998 }, Coordinate { latitude: 57.9269410000001, longitude: -6.66638899999998 }, Coordinate { latitude: 57.9580540000001, longitude: -6.69194499999992 }, Coordinate { latitude: 57.967499, longitude: -6.69861100000003 }, Coordinate { latitude: 57.986664, longitude: -6.704722 }, Coordinate { latitude: 57.998886, longitude: -6.70694399999996 }, Coordinate { latitude: 58.0075, longitude: -6.70611199999996 }, Coordinate { latitude: 58.0213850000001, longitude: -6.69749999999999 }, Coordinate { latitude: 58.024437, longitude: -6.69444499999992 }, Coordinate { latitude: 58.0444410000001, longitude: -6.662778 }, Coordinate { latitude: 58.046661, longitude: -6.65916700000002 }, Coordinate { latitude: 58.048332, longitude: -6.65277900000001 }, Coordinate { latitude: 58.048332, longitude: -6.62944499999998 }, Coordinate { latitude: 58.0477750000001, longitude: -6.62194499999998 }, Coordinate { latitude: 58.0461040000001, longitude: -6.61500100000001 }, Coordinate { latitude: 58.045273, longitude: -6.59861199999995 }, Coordinate { latitude: 58.046387, longitude: -6.59361199999995 }, Coordinate { latitude: 58.0499950000001, longitude: -6.59027900000001 }, Coordinate { latitude: 58.0524980000001, longitude: -6.59527799999995 }, Coordinate { latitude: 58.053886, longitude: -6.60027799999995 }, Coordinate { latitude: 58.0547180000001, longitude: -6.60777899999994 }, Coordinate { latitude: 58.0580520000001, longitude: -6.66999999999996 }, Coordinate { latitude: 58.0583270000001, longitude: -6.67833399999995 }, Coordinate { latitude: 58.057495, longitude: -6.68444499999993 }, Coordinate { latitude: 58.0549930000001, longitude: -6.68916699999994 }, Coordinate { latitude: 57.9983290000001, longitude: -6.76138999999995 }, Coordinate { latitude: 57.954437, longitude: -6.72583400000002 }, Coordinate { latitude: 57.951111, longitude: -6.72277799999995 }, Coordinate { latitude: 57.9491650000001, longitude: -6.71888899999993 }, Coordinate { latitude: 57.946938, longitude: -6.70527799999996 }, Coordinate { latitude: 57.9424970000001, longitude: -6.69638900000001 }, Coordinate { latitude: 57.934441, longitude: -6.68499999999995 }, Coordinate { latitude: 57.928329, longitude: -6.67972300000002 }, Coordinate { latitude: 57.9255519999999, longitude: -6.67750099999995 }, Coordinate { latitude: 57.9005510000001, longitude: -6.66472199999998 }, Coordinate { latitude: 57.8847200000001, longitude: -6.66055599999999 }, Coordinate { latitude: 57.880554, longitude: -6.66222299999998 }, Coordinate { latitude: 57.825829, longitude: -6.73527799999999 }, Coordinate { latitude: 57.7274930000001, longitude: -6.96083399999992 }, Coordinate { latitude: 57.7255549999999, longitude: -6.96555599999999 }, Coordinate { latitude: 57.724716, longitude: -6.97250099999997 }, Coordinate { latitude: 57.72583, longitude: -6.97833299999996 }, Coordinate { latitude: 57.7283330000001, longitude: -6.98388999999997 }, Coordinate { latitude: 57.814163, longitude: -7.120001 }, Coordinate { latitude: 57.817497, longitude: -7.12305599999996 }, Coordinate { latitude: 57.820831, longitude: -7.12444499999998 }, Coordinate { latitude: 57.833328, longitude: -7.126667 }, Coordinate { latitude: 57.8377760000001, longitude: -7.12527799999998 }, Coordinate { latitude: 57.838051, longitude: -7.118334 }, Coordinate { latitude: 57.836662, longitude: -7.10388899999992 }, Coordinate { latitude: 57.8327710000001, longitude: -7.09222299999999 }, Coordinate { latitude: 57.824715, longitude: -7.08361100000002 }, Coordinate { latitude: 57.820831, longitude: -7.06583399999994 }, Coordinate { latitude: 57.8322219999999, longitude: -7.02888999999993 }, Coordinate { latitude: 57.900833, longitude: -6.83027799999996 }, Coordinate { latitude: 57.9036100000001, longitude: -6.83416699999998 }, Coordinate { latitude: 57.9324950000001, longitude: -6.87944499999992 }, Coordinate { latitude: 57.9497150000001, longitude: -6.935 }, Coordinate { latitude: 57.9527740000001, longitude: -6.94611200000003 }, Coordinate { latitude: 57.959442, longitude: -6.98500099999995 }, Coordinate { latitude: 57.95916, longitude: -6.99277799999993 }, Coordinate { latitude: 57.9519420000001, longitude: -7.02194499999996 }, Coordinate { latitude: 57.952217, longitude: -7.02972299999993 }, Coordinate { latitude: 57.953331, longitude: -7.03555599999993 }, Coordinate { latitude: 57.962494, longitude: -7.07527800000003 }, Coordinate { latitude: 57.9838870000001, longitude: -7.11277899999999 }, Coordinate { latitude: 57.987221, longitude: -7.11389000000003 }, Coordinate { latitude: 58.0080490000001, longitude: -7.08416699999998 }, Coordinate { latitude: 58.0202710000001, longitude: -7.05555599999997 }, Coordinate { latitude: 58.0363850000001, longitude: -7.05777799999998 }, Coordinate { latitude: 58.0705490000001, longitude: -7.09388899999999 }, Coordinate { latitude: 58.1233290000001, longitude: -7.126667 }, Coordinate { latitude: 58.1302720000001, longitude: -7.128334 }, Coordinate { latitude: 58.1347200000001, longitude: -7.12805599999996 }, Coordinate { latitude: 58.181938, longitude: -7.09444499999995 }, Coordinate { latitude: 58.2202760000001, longitude: -7.05916699999995 }, Coordinate { latitude: 58.223328, longitude: -7.05555599999997 }, Coordinate { latitude: 58.2333300000001, longitude: -7.04055599999992 }, Coordinate { latitude: 58.238052, longitude: -7.03194500000001 }, Coordinate { latitude: 58.2352750000001, longitude: -7.00805600000001 }, Coordinate { latitude: 58.2344440000001, longitude: -7.00111199999992 }, Coordinate { latitude: 58.2161100000001, longitude: -6.91972299999992 }, Coordinate { latitude: 58.212776, longitude: -6.90805599999993 }, Coordinate { latitude: 58.209717, longitude: -6.90583399999997 }, Coordinate { latitude: 58.206108, longitude: -6.90805599999993 }, Coordinate { latitude: 58.2036060000001, longitude: -6.92027899999999 }, Coordinate { latitude: 58.1880490000001, longitude: -6.93611099999998 }, Coordinate { latitude: 58.1111069999999, longitude: -6.87416699999994 }, Coordinate { latitude: 58.1061100000001, longitude: -6.86805599999997 }, Coordinate { latitude: 58.1038820000001, longitude: -6.86194499999999 }, Coordinate { latitude: 58.108055, longitude: -6.86000099999995 }, Coordinate { latitude: 58.178593, longitude: -6.87327900000003 }, Coordinate { latitude: 58.1958660000001, longitude: -6.805183 }, Coordinate { latitude: 58.185238, longitude: -6.75037400000002 }, Coordinate { latitude: 58.1971970000001, longitude: -6.74472799999995 }, Coordinate { latitude: 58.2294160000001, longitude: -6.78658199999995 }, Coordinate { latitude: 58.2597200000001, longitude: -6.80805600000002 }, Coordinate { latitude: 58.2799990000001, longitude: -6.81777899999997 }, Coordinate { latitude: 58.284721, longitude: -6.81555600000002 }, Coordinate { latitude: 58.302216, longitude: -6.79777799999994 }, Coordinate { latitude: 58.349159, longitude: -6.67305599999997 }, Coordinate { latitude: 58.349442, longitude: -6.65833400000002 }, Coordinate { latitude: 58.3486100000001, longitude: -6.65222299999994 }, Coordinate { latitude: 58.3419420000001, longitude: -6.64694500000002 }, Coordinate { latitude: 58.3597180000001, longitude: -6.56027799999998 }, Coordinate { latitude: 58.3633270000001, longitude: -6.55027899999999 }, Coordinate { latitude: 58.4574969999999, longitude: -6.355278 }, Coordinate { latitude: 58.479164, longitude: -6.31055600000002 }, Coordinate { latitude: 58.488327, longitude: -6.292778 }, Coordinate { latitude: 58.5083310000001, longitude: -6.27694500000001 }, Coordinate { latitude: 58.5105510000001, longitude: -6.272223 }, Coordinate { latitude: 58.512497, longitude: -6.26694500000002 }, Coordinate { latitude: 58.512772, longitude: -6.25972299999995 }, Coordinate { latitude: 58.5116650000001, longitude: -6.25305599999996 }, Coordinate { latitude: 58.5086060000001, longitude: -6.24444499999998 }, Coordinate { latitude: 58.5041660000001, longitude: -6.23472299999992 }, Coordinate { latitude: 58.496384, longitude: -6.22333299999997 }, Coordinate { latitude: 58.4252780000001, longitude: -6.166112 }, Coordinate { latitude: 58.4205550000001, longitude: -6.16583300000002 }, Coordinate { latitude: 58.35611, longitude: -6.20416699999998 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 53.229721, longitude: -4.13805600000001 }, Coordinate { latitude: 53.229721, longitude: -4.13111099999998 }, Coordinate { latitude: 53.2274930000001, longitude: -4.105278 }, Coordinate { latitude: 53.226387, longitude: -4.06638900000002 }, Coordinate { latitude: 53.237495, longitude: -4.01861200000002 }, Coordinate { latitude: 53.241943, longitude: -4.00305599999996 }, Coordinate { latitude: 53.284439, longitude: -3.85444499999994 }, Coordinate { latitude: 53.290276, longitude: -3.732778 }, Coordinate { latitude: 53.2886050000001, longitude: -3.72750000000002 }, Coordinate { latitude: 53.285553, longitude: -3.6925 }, Coordinate { latitude: 53.27916, longitude: -3.61305599999992 }, Coordinate { latitude: 53.2797160000001, longitude: -3.60666700000002 }, Coordinate { latitude: 53.282219, longitude: -3.58944499999996 }, Coordinate { latitude: 53.3205490000001, longitude: -3.46166699999998 }, Coordinate { latitude: 53.343605, longitude: -3.38805600000001 }, Coordinate { latitude: 53.3461070000001, longitude: -3.36277799999993 }, Coordinate { latitude: 53.347221, longitude: -3.33638899999994 }, Coordinate { latitude: 53.347221, longitude: -3.32277799999997 }, Coordinate { latitude: 53.346664, longitude: -3.315 }, Coordinate { latitude: 53.2974930000001, longitude: -3.21166699999998 }, Coordinate { latitude: 53.2575000000001, longitude: -3.13055599999996 }, Coordinate { latitude: 53.253609, longitude: -3.12138899999997 }, Coordinate { latitude: 53.2477720000001, longitude: -3.10222199999993 }, Coordinate { latitude: 53.2600100000001, longitude: -3.08859899999999 }, Coordinate { latitude: 53.2638850000001, longitude: -3.08361100000002 }, Coordinate { latitude: 53.2674940000001, longitude: -3.08166699999998 }, Coordinate { latitude: 53.2713850000001, longitude: -3.08249999999998 }, Coordinate { latitude: 53.3249970000001, longitude: -3.12611199999998 }, Coordinate { latitude: 53.348328, longitude: -3.15416699999992 }, Coordinate { latitude: 53.3561100000001, longitude: -3.164444 }, Coordinate { latitude: 53.3580550000001, longitude: -3.16944499999994 }, Coordinate { latitude: 53.3627780000001, longitude: -3.17638899999997 }, Coordinate { latitude: 53.374443, longitude: -3.18722200000002 }, Coordinate { latitude: 53.3811040000001, longitude: -3.19055600000002 }, Coordinate { latitude: 53.3855510000001, longitude: -3.19222300000001 }, Coordinate { latitude: 53.391106, longitude: -3.18722200000002 }, Coordinate { latitude: 53.3961110000001, longitude: -3.18027799999993 }, Coordinate { latitude: 53.4002760000001, longitude: -3.17083399999996 }, Coordinate { latitude: 53.408562, longitude: -3.07573699999995 }, Coordinate { latitude: 53.4101640000001, longitude: -3.06922200000002 }, Coordinate { latitude: 53.4108310000001, longitude: -3.06172299999997 }, Coordinate { latitude: 53.4095, longitude: -3.05455599999999 }, Coordinate { latitude: 53.407497, longitude: -3.04838899999999 }, Coordinate { latitude: 53.404663, longitude: -3.04438899999997 }, Coordinate { latitude: 53.4011610000001, longitude: -3.04088899999994 }, Coordinate { latitude: 53.3863300000001, longitude: -3.02988899999997 }, Coordinate { latitude: 53.3774950000001, longitude: -3.02788899999996 }, Coordinate { latitude: 53.3672180000001, longitude: -2.98944499999993 }, Coordinate { latitude: 53.3105550000001, longitude: -2.94249999999994 }, Coordinate { latitude: 53.3021620000001, longitude: -2.928292 }, Coordinate { latitude: 53.289162, longitude: -2.89972299999999 }, Coordinate { latitude: 53.2852710000001, longitude: -2.88249999999994 }, Coordinate { latitude: 53.2827760000001, longitude: -2.86222299999997 }, Coordinate { latitude: 53.292496, longitude: -2.77638899999999 }, Coordinate { latitude: 53.303055, longitude: -2.75499999999994 }, Coordinate { latitude: 53.3055500000001, longitude: -2.75138899999996 }, Coordinate { latitude: 53.3463820000001, longitude: -2.70249999999999 }, Coordinate { latitude: 53.3502730000001, longitude: -2.70083399999999 }, Coordinate { latitude: 53.352493, longitude: -2.70444499999996 }, Coordinate { latitude: 53.353333, longitude: -2.71194499999996 }, Coordinate { latitude: 53.352493, longitude: -2.71749999999997 }, Coordinate { latitude: 53.3411100000001, longitude: -2.76527800000002 }, Coordinate { latitude: 53.3374940000001, longitude: -2.77361200000001 }, Coordinate { latitude: 53.334442, longitude: -2.77666699999997 }, Coordinate { latitude: 53.331108, longitude: -2.77888899999999 }, Coordinate { latitude: 53.3205490000001, longitude: -2.853611 }, Coordinate { latitude: 53.321106, longitude: -2.86111099999999 }, Coordinate { latitude: 53.324165, longitude: -2.87361099999993 }, Coordinate { latitude: 53.3272170000001, longitude: -2.88305600000001 }, Coordinate { latitude: 53.3602750000001, longitude: -2.95388899999995 }, Coordinate { latitude: 53.367775, longitude: -2.96388899999999 }, Coordinate { latitude: 53.4173850000001, longitude: -3.00677799999994 }, Coordinate { latitude: 53.425053, longitude: -3.01327799999996 }, Coordinate { latitude: 53.551666, longitude: -3.10750000000002 }, Coordinate { latitude: 53.5602720000001, longitude: -3.10666700000002 }, Coordinate { latitude: 53.5638890000001, longitude: -3.10416700000002 }, Coordinate { latitude: 53.5763850000001, longitude: -3.09361099999995 }, Coordinate { latitude: 53.5980530000001, longitude: -3.07305600000001 }, Coordinate { latitude: 53.690552, longitude: -2.98222299999998 }, Coordinate { latitude: 53.693604, longitude: -2.97861099999994 }, Coordinate { latitude: 53.6955490000001, longitude: -2.97416699999997 }, Coordinate { latitude: 53.7080540000001, longitude: -2.94222299999996 }, Coordinate { latitude: 53.7205510000001, longitude: -2.90222299999999 }, Coordinate { latitude: 53.723053, longitude: -2.898889 }, Coordinate { latitude: 53.726662, longitude: -2.89749999999998 }, Coordinate { latitude: 53.7297209999999, longitude: -2.90055599999999 }, Coordinate { latitude: 53.731667, longitude: -2.90416699999997 }, Coordinate { latitude: 53.7330550000001, longitude: -2.91027799999995 }, Coordinate { latitude: 53.7344440000001, longitude: -2.92444499999999 }, Coordinate { latitude: 53.734718, longitude: -2.93944499999998 }, Coordinate { latitude: 53.7336040000001, longitude: -2.96611100000001 }, Coordinate { latitude: 53.7327730000001, longitude: -2.99277799999993 }, Coordinate { latitude: 53.734993, longitude: -3.00638900000001 }, Coordinate { latitude: 53.739716, longitude: -3.02166699999998 }, Coordinate { latitude: 53.7469410000001, longitude: -3.03361100000001 }, Coordinate { latitude: 53.751938, longitude: -3.04055599999998 }, Coordinate { latitude: 53.7647170000001, longitude: -3.05138899999997 }, Coordinate { latitude: 53.7699969999999, longitude: -3.05416699999995 }, Coordinate { latitude: 53.7808300000001, longitude: -3.05805599999997 }, Coordinate { latitude: 53.7888870000001, longitude: -3.05972199999997 }, Coordinate { latitude: 53.797493, longitude: -3.05972199999997 }, Coordinate { latitude: 53.90583, longitude: -3.05305599999997 }, Coordinate { latitude: 53.909439, longitude: -3.05222199999997 }, Coordinate { latitude: 53.916382, longitude: -3.04722299999997 }, Coordinate { latitude: 53.9211040000001, longitude: -3.03972199999993 }, Coordinate { latitude: 53.9261090000001, longitude: -3.02499999999998 }, Coordinate { latitude: 53.9505540000001, longitude: -2.9325 }, Coordinate { latitude: 53.998886, longitude: -2.89694499999996 }, Coordinate { latitude: 54.0849990000001, longitude: -2.83361099999996 }, Coordinate { latitude: 54.142776, longitude: -2.8175 }, Coordinate { latitude: 54.222771, longitude: -2.81361199999998 }, Coordinate { latitude: 54.155273, longitude: -2.92666700000001 }, Coordinate { latitude: 54.151382, longitude: -2.93527799999998 }, Coordinate { latitude: 54.0819400000001, longitude: -3.15222299999999 }, Coordinate { latitude: 54.0955510000001, longitude: -3.21472299999994 }, Coordinate { latitude: 54.0986100000001, longitude: -3.226111 }, Coordinate { latitude: 54.103333, longitude: -3.23388899999998 }, Coordinate { latitude: 54.244438, longitude: -3.38055600000001 }, Coordinate { latitude: 54.276665, longitude: -3.40916700000002 }, Coordinate { latitude: 54.2836070000001, longitude: -3.411945 }, Coordinate { latitude: 54.291107, longitude: -3.41222199999993 }, Coordinate { latitude: 54.3480530000001, longitude: -3.43388899999997 }, Coordinate { latitude: 54.378609, longitude: -3.46611100000001 }, Coordinate { latitude: 54.403328, longitude: -3.49305600000002 }, Coordinate { latitude: 54.426109, longitude: -3.52472299999994 }, Coordinate { latitude: 54.4483260000001, longitude: -3.55694499999993 }, Coordinate { latitude: 54.4886089999999, longitude: -3.61305599999992 }, Coordinate { latitude: 54.5058290000001, longitude: -3.62972299999996 }, Coordinate { latitude: 54.51194, longitude: -3.63416699999993 }, Coordinate { latitude: 54.515549, longitude: -3.63333399999993 }, Coordinate { latitude: 54.6424940000001, longitude: -3.56916699999999 }, Coordinate { latitude: 54.8155520000001, longitude: -3.42916700000001 }, Coordinate { latitude: 54.8763890000001, longitude: -3.39166699999998 }, Coordinate { latitude: 54.8844379999999, longitude: -3.38111099999992 }, Coordinate { latitude: 54.936943, longitude: -3.29194499999994 }, Coordinate { latitude: 54.9388890000001, longitude: -3.28666699999997 }, Coordinate { latitude: 54.941383, longitude: -3.26999999999998 }, Coordinate { latitude: 54.94944, longitude: -3.20861099999996 }, Coordinate { latitude: 54.9499970000001, longitude: -3.19472300000001 }, Coordinate { latitude: 54.948608, longitude: -3.18944499999992 }, Coordinate { latitude: 54.946106, longitude: -3.185 }, Coordinate { latitude: 54.9422150000001, longitude: -3.18333299999995 }, Coordinate { latitude: 54.9405520000001, longitude: -3.17888900000003 }, Coordinate { latitude: 54.9313890000001, longitude: -3.13638899999995 }, Coordinate { latitude: 54.9313890000001, longitude: -3.12944499999998 }, Coordinate { latitude: 54.933884, longitude: -3.10333300000002 }, Coordinate { latitude: 54.9455490000001, longitude: -3.02638899999994 }, Coordinate { latitude: 54.94944, longitude: -3.02499999999998 }, Coordinate { latitude: 54.970551, longitude: -3.02305599999994 }, Coordinate { latitude: 54.9752730000001, longitude: -3.03111100000001 }, Coordinate { latitude: 54.9788820000001, longitude: -3.04138899999998 }, Coordinate { latitude: 54.9798660000001, longitude: -3.05102599999998 }, Coordinate { latitude: 54.9752730000001, longitude: -3.06388900000002 }, Coordinate { latitude: 54.9741590000001, longitude: -3.06888900000001 }, Coordinate { latitude: 54.9649960000001, longitude: -3.14361100000002 }, Coordinate { latitude: 54.9649960000001, longitude: -3.15027800000001 }, Coordinate { latitude: 54.971382, longitude: -3.36055599999997 }, Coordinate { latitude: 54.972496, longitude: -3.37638900000002 }, Coordinate { latitude: 54.9741590000001, longitude: -3.390556 }, Coordinate { latitude: 54.986382, longitude: -3.44527799999997 }, Coordinate { latitude: 54.990829, longitude: -3.57111099999992 }, Coordinate { latitude: 54.9716640000001, longitude: -3.58027799999996 }, Coordinate { latitude: 54.9672160000001, longitude: -3.58111099999996 }, Coordinate { latitude: 54.8752749999999, longitude: -3.61583400000001 }, Coordinate { latitude: 54.8774950000001, longitude: -3.62888899999996 }, Coordinate { latitude: 54.8811039999999, longitude: -3.68888900000002 }, Coordinate { latitude: 54.8811039999999, longitude: -3.69611099999997 }, Coordinate { latitude: 54.8488850000001, longitude: -3.81222199999996 }, Coordinate { latitude: 54.8052750000001, longitude: -3.86972200000002 }, Coordinate { latitude: 54.7674940000001, longitude: -3.95361100000002 }, Coordinate { latitude: 54.7652739999999, longitude: -3.96499999999998 }, Coordinate { latitude: 54.7652739999999, longitude: -3.97944499999994 }, Coordinate { latitude: 54.767776, longitude: -4.09555599999993 }, Coordinate { latitude: 54.774719, longitude: -4.13583399999993 }, Coordinate { latitude: 54.8577730000001, longitude: -4.34833299999997 }, Coordinate { latitude: 54.860275, longitude: -4.35277799999994 }, Coordinate { latitude: 54.879166, longitude: -4.37611199999998 }, Coordinate { latitude: 54.88472, longitude: -4.38083399999999 }, Coordinate { latitude: 54.8886110000001, longitude: -4.38194499999997 }, Coordinate { latitude: 54.8977740000001, longitude: -4.37944499999998 }, Coordinate { latitude: 54.901665, longitude: -4.37972300000001 }, Coordinate { latitude: 54.904999, longitude: -4.38138999999995 }, Coordinate { latitude: 54.907494, longitude: -4.38499999999999 }, Coordinate { latitude: 54.9080510000001, longitude: -4.39305599999994 }, Coordinate { latitude: 54.9063870000001, longitude: -4.39805599999994 }, Coordinate { latitude: 54.8830490000001, longitude: -4.42333399999995 }, Coordinate { latitude: 54.879997, longitude: -4.42555599999997 }, Coordinate { latitude: 54.8722150000001, longitude: -4.42916699999995 }, Coordinate { latitude: 54.863609, longitude: -4.42888899999997 }, Coordinate { latitude: 54.860275, longitude: -4.42805599999997 }, Coordinate { latitude: 54.8258290000001, longitude: -4.411112 }, Coordinate { latitude: 54.7711110000001, longitude: -4.35972299999992 }, Coordinate { latitude: 54.7111050000001, longitude: -4.34611100000001 }, Coordinate { latitude: 54.7072219999999, longitude: -4.34527800000001 }, Coordinate { latitude: 54.699165, longitude: -4.34805599999999 }, Coordinate { latitude: 54.688049, longitude: -4.35583399999996 }, Coordinate { latitude: 54.6802750000001, longitude: -4.36500100000001 }, Coordinate { latitude: 54.6766660000001, longitude: -4.375834 }, Coordinate { latitude: 54.675552, longitude: -4.38722199999995 }, Coordinate { latitude: 54.6769410000001, longitude: -4.40222299999994 }, Coordinate { latitude: 54.6988830000001, longitude: -4.49638899999997 }, Coordinate { latitude: 54.702774, longitude: -4.50611099999998 }, Coordinate { latitude: 54.7374950000001, longitude: -4.55694499999993 }, Coordinate { latitude: 54.740555, longitude: -4.55888900000002 }, Coordinate { latitude: 54.748329, longitude: -4.56 }, Coordinate { latitude: 54.751663, longitude: -4.561667 }, Coordinate { latitude: 54.780273, longitude: -4.598612 }, Coordinate { latitude: 54.7997209999999, longitude: -4.680834 }, Coordinate { latitude: 54.821663, longitude: -4.74055600000003 }, Coordinate { latitude: 54.8530500000001, longitude: -4.79722299999997 }, Coordinate { latitude: 54.858055, longitude: -4.80527799999999 }, Coordinate { latitude: 54.861664, longitude: -4.81416699999994 }, Coordinate { latitude: 54.8644410000001, longitude: -4.82555600000001 }, Coordinate { latitude: 54.868607, longitude: -4.85222199999998 }, Coordinate { latitude: 54.8519440000001, longitude: -4.89388899999994 }, Coordinate { latitude: 54.839439, longitude: -4.92027899999999 }, Coordinate { latitude: 54.8347170000001, longitude: -4.92833399999995 }, Coordinate { latitude: 54.8297200000001, longitude: -4.93555600000002 }, Coordinate { latitude: 54.802498, longitude: -4.96111199999996 }, Coordinate { latitude: 54.7977750000001, longitude: -4.96194499999996 }, Coordinate { latitude: 54.7936100000001, longitude: -4.95999999999998 }, Coordinate { latitude: 54.7674940000001, longitude: -4.94472300000001 }, Coordinate { latitude: 54.71666, longitude: -4.911945 }, Coordinate { latitude: 54.7011110000001, longitude: -4.90000099999992 }, Coordinate { latitude: 54.6969380000001, longitude: -4.89083399999993 }, Coordinate { latitude: 54.6952740000001, longitude: -4.88499999999999 }, Coordinate { latitude: 54.6911090000001, longitude: -4.876667 }, Coordinate { latitude: 54.6852719999999, longitude: -4.87027799999998 }, Coordinate { latitude: 54.6824950000001, longitude: -4.868334 }, Coordinate { latitude: 54.6313860000001, longitude: -4.85583400000002 }, Coordinate { latitude: 54.6277770000001, longitude: -4.85861199999994 }, Coordinate { latitude: 54.62722, longitude: -4.86416700000001 }, Coordinate { latitude: 54.6405490000001, longitude: -4.92250099999995 }, Coordinate { latitude: 54.6444400000001, longitude: -4.93250099999995 }, Coordinate { latitude: 54.6488880000001, longitude: -4.94111199999992 }, Coordinate { latitude: 54.6533279999999, longitude: -4.94833399999999 }, Coordinate { latitude: 54.6566620000001, longitude: -4.95194499999997 }, Coordinate { latitude: 54.6733320000001, longitude: -4.96055599999994 }, Coordinate { latitude: 54.6802750000001, longitude: -4.96333399999997 }, Coordinate { latitude: 54.683884, longitude: -4.96361199999996 }, Coordinate { latitude: 54.6874920000001, longitude: -4.96166699999998 }, Coordinate { latitude: 54.6930540000001, longitude: -4.95444499999996 }, Coordinate { latitude: 54.7002720000001, longitude: -4.95083399999999 }, Coordinate { latitude: 54.7227710000001, longitude: -4.95694399999996 }, Coordinate { latitude: 54.725555, longitude: -4.95999999999998 }, Coordinate { latitude: 54.7633290000001, longitude: -5.00499999999994 }, Coordinate { latitude: 54.7822190000001, longitude: -5.03527799999995 }, Coordinate { latitude: 54.805832, longitude: -5.07472199999995 }, Coordinate { latitude: 54.821663, longitude: -5.10250099999996 }, Coordinate { latitude: 54.8291630000001, longitude: -5.11333399999995 }, Coordinate { latitude: 54.834442, longitude: -5.12000099999995 }, Coordinate { latitude: 54.8452760000001, longitude: -5.13194499999992 }, Coordinate { latitude: 54.857216, longitude: -5.142222 }, Coordinate { latitude: 54.8911060000001, longitude: -5.17000000000002 }, Coordinate { latitude: 54.900551, longitude: -5.17638999999997 }, Coordinate { latitude: 54.9080510000001, longitude: -5.17944499999999 }, Coordinate { latitude: 54.921661, longitude: -5.18444499999998 }, Coordinate { latitude: 54.9346540000001, longitude: -5.18569400000001 }, Coordinate { latitude: 54.937775, longitude: -5.18555599999996 }, Coordinate { latitude: 54.988884, longitude: -5.17833400000001 }, Coordinate { latitude: 55.0005489999999, longitude: -5.17416700000001 }, Coordinate { latitude: 55.008888, longitude: -5.16222299999993 }, Coordinate { latitude: 55.0116650000001, longitude: -5.15222299999994 }, Coordinate { latitude: 55.0238880000001, longitude: -5.10499999999996 }, Coordinate { latitude: 55.046661, longitude: -5.05416700000001 }, Coordinate { latitude: 55.051384, longitude: -5.05305600000003 }, Coordinate { latitude: 55.1316600000001, longitude: -5.01361200000002 }, Coordinate { latitude: 55.135277, longitude: -5.01139000000001 }, Coordinate { latitude: 55.141937, longitude: -4.99916699999994 }, Coordinate { latitude: 55.1549990000001, longitude: -4.97388899999993 }, Coordinate { latitude: 55.1786040000001, longitude: -4.93499999999995 }, Coordinate { latitude: 55.219162, longitude: -4.868334 }, Coordinate { latitude: 55.2222210000001, longitude: -4.86555600000003 }, Coordinate { latitude: 55.2261050000001, longitude: -4.86389000000003 }, Coordinate { latitude: 55.2694400000001, longitude: -4.84777799999995 }, Coordinate { latitude: 55.310829, longitude: -4.83916799999997 }, Coordinate { latitude: 55.319443, longitude: -4.83833399999997 }, Coordinate { latitude: 55.322495, longitude: -4.835556 }, Coordinate { latitude: 55.409164, longitude: -4.75027799999992 }, Coordinate { latitude: 55.411942, longitude: -4.746667 }, Coordinate { latitude: 55.4202730000001, longitude: -4.72888899999998 }, Coordinate { latitude: 55.424995, longitude: -4.71361200000001 }, Coordinate { latitude: 55.4338840000001, longitude: -4.682501 }, Coordinate { latitude: 55.436661, longitude: -4.65666699999997 }, Coordinate { latitude: 55.437775, longitude: -4.65083399999997 }, Coordinate { latitude: 55.4413830000001, longitude: -4.641389 }, Coordinate { latitude: 55.443886, longitude: -4.63777800000003 }, Coordinate { latitude: 55.486382, longitude: -4.61388999999997 }, Coordinate { latitude: 55.494995, longitude: -4.61333399999995 }, Coordinate { latitude: 55.512215, longitude: -4.62194499999998 }, Coordinate { latitude: 55.515549, longitude: -4.62388899999996 }, Coordinate { latitude: 55.5619430000001, longitude: -4.65944499999995 }, Coordinate { latitude: 55.595833, longitude: -4.685834 }, Coordinate { latitude: 55.599159, longitude: -4.68861199999998 }, Coordinate { latitude: 55.6044390000001, longitude: -4.69500099999993 }, Coordinate { latitude: 55.606941, longitude: -4.69861100000003 }, Coordinate { latitude: 55.6111070000001, longitude: -4.70777800000002 }, Coordinate { latitude: 55.6177750000001, longitude: -4.729445 }, Coordinate { latitude: 55.628609, longitude: -4.76916699999998 }, Coordinate { latitude: 55.6455540000001, longitude: -4.81361199999998 }, Coordinate { latitude: 55.672218, longitude: -4.86083400000001 }, Coordinate { latitude: 55.6819380000001, longitude: -4.875834 }, Coordinate { latitude: 55.6897200000001, longitude: -4.90388999999999 }, Coordinate { latitude: 55.6969380000001, longitude: -4.91583299999996 }, Coordinate { latitude: 55.7047200000001, longitude: -4.916945 }, Coordinate { latitude: 55.9322200000001, longitude: -4.88111099999998 }, Coordinate { latitude: 55.936104, longitude: -4.87972299999996 }, Coordinate { latitude: 55.938889, longitude: -4.87611199999998 }, Coordinate { latitude: 55.9494970000001, longitude: -4.82405599999998 }, Coordinate { latitude: 55.9528270000001, longitude: -4.79738999999995 }, Coordinate { latitude: 55.9523320000001, longitude: -4.79255599999993 }, Coordinate { latitude: 55.951332, longitude: -4.78938999999997 }, Coordinate { latitude: 55.9469990000001, longitude: -4.78222299999993 }, Coordinate { latitude: 55.9461059999999, longitude: -4.751667 }, Coordinate { latitude: 55.934441, longitude: -4.71333399999992 }, Coordinate { latitude: 55.933609, longitude: -4.70611200000002 }, Coordinate { latitude: 55.921104, longitude: -4.57027799999997 }, Coordinate { latitude: 55.9186100000001, longitude: -4.523056 }, Coordinate { latitude: 55.921104, longitude: -4.48166800000001 }, Coordinate { latitude: 55.9261090000001, longitude: -4.48916700000001 }, Coordinate { latitude: 55.929161, longitude: -4.50111199999998 }, Coordinate { latitude: 55.945549, longitude: -4.62722300000002 }, Coordinate { latitude: 55.9797710000001, longitude: -4.77659299999993 }, Coordinate { latitude: 55.9764180000001, longitude: -4.81015000000002 }, Coordinate { latitude: 55.9864850000001, longitude: -4.85461199999992 }, Coordinate { latitude: 56.0317840000001, longitude: -4.86635699999994 }, Coordinate { latitude: 56.0703770000001, longitude: -4.85964599999994 }, Coordinate { latitude: 56.0863150000001, longitude: -4.84622300000001 }, Coordinate { latitude: 56.1131629999999, longitude: -4.82860599999998 }, Coordinate { latitude: 56.1056100000001, longitude: -4.86719599999998 }, Coordinate { latitude: 56.071217, longitude: -4.88145800000001 }, Coordinate { latitude: 55.981449, longitude: -4.898236 }, Coordinate { latitude: 55.961315, longitude: -4.91333699999996 }, Coordinate { latitude: 55.9336320000001, longitude: -4.92843800000003 }, Coordinate { latitude: 55.879997, longitude: -4.96194499999996 }, Coordinate { latitude: 55.866104, longitude: -4.97888899999992 }, Coordinate { latitude: 55.864716, longitude: -4.98500100000001 }, Coordinate { latitude: 55.8644410000001, longitude: -4.99138899999997 }, Coordinate { latitude: 55.8669430000001, longitude: -5.01222200000001 }, Coordinate { latitude: 55.86972, longitude: -5.02583399999997 }, Coordinate { latitude: 55.9030530000001, longitude: -5.11000099999995 }, Coordinate { latitude: 55.929161, longitude: -5.17333400000001 }, Coordinate { latitude: 55.9218860000001, longitude: -5.20612099999994 }, Coordinate { latitude: 55.901752, longitude: -5.22457699999995 }, Coordinate { latitude: 55.8740690000001, longitude: -5.22961099999992 }, Coordinate { latitude: 55.844444, longitude: -5.208056 }, Coordinate { latitude: 55.833611, longitude: -5.20277800000002 }, Coordinate { latitude: 55.8291630000001, longitude: -5.20444500000002 }, Coordinate { latitude: 55.8263850000001, longitude: -5.208056 }, Coordinate { latitude: 55.8258290000001, longitude: -5.21472299999999 }, Coordinate { latitude: 55.8474960000001, longitude: -5.29250000000002 }, Coordinate { latitude: 55.850555, longitude: -5.30333399999995 }, Coordinate { latitude: 55.853882, longitude: -5.30722199999997 }, Coordinate { latitude: 55.897217, longitude: -5.33861199999996 }, Coordinate { latitude: 55.900833, longitude: -5.34027899999995 }, Coordinate { latitude: 55.9049989999999, longitude: -5.34055599999999 }, Coordinate { latitude: 55.9261090000001, longitude: -5.34083399999997 }, Coordinate { latitude: 56.002495, longitude: -5.30972199999997 }, Coordinate { latitude: 56.005329, longitude: -5.30938900000001 }, Coordinate { latitude: 56.0075000000001, longitude: -5.30855600000001 }, Coordinate { latitude: 56.0344960000001, longitude: -5.28105599999992 }, Coordinate { latitude: 56.0416600000001, longitude: -5.27355599999993 }, Coordinate { latitude: 56.1172180000001, longitude: -5.20277800000002 }, Coordinate { latitude: 56.119995, longitude: -5.19861100000003 }, Coordinate { latitude: 56.1869430000001, longitude: -5.07222299999995 }, Coordinate { latitude: 56.23333, longitude: -4.97416700000002 }, Coordinate { latitude: 56.2500000000001, longitude: -4.94726300000002 }, Coordinate { latitude: 56.264999, longitude: -4.92305599999997 }, Coordinate { latitude: 56.2711110000001, longitude: -4.91805599999998 }, Coordinate { latitude: 56.274437, longitude: -4.92055599999998 }, Coordinate { latitude: 56.2738880000001, longitude: -4.92750099999995 }, Coordinate { latitude: 56.2324980000001, longitude: -5.03222299999999 }, Coordinate { latitude: 56.137215, longitude: -5.20583299999993 }, Coordinate { latitude: 56.1188890000001, longitude: -5.23889000000003 }, Coordinate { latitude: 56.1069410000001, longitude: -5.25888900000001 }, Coordinate { latitude: 56.0840530000001, longitude: -5.28744499999999 }, Coordinate { latitude: 56.069221, longitude: -5.30594500000001 }, Coordinate { latitude: 56.055386, longitude: -5.316778 }, Coordinate { latitude: 56.0345540000001, longitude: -5.33894399999997 }, Coordinate { latitude: 56.024887, longitude: -5.35611199999994 }, Coordinate { latitude: 56.0, longitude: -5.39083399999993 }, Coordinate { latitude: 55.9994430000001, longitude: -5.39777900000001 }, Coordinate { latitude: 55.9997180000001, longitude: -5.40416699999992 }, Coordinate { latitude: 56.003326, longitude: -5.42333399999995 }, Coordinate { latitude: 56.0049970000001, longitude: -5.42888900000003 }, Coordinate { latitude: 56.007774, longitude: -5.431667 }, Coordinate { latitude: 55.906662, longitude: -5.41888899999998 }, Coordinate { latitude: 55.750275, longitude: -5.38 }, Coordinate { latitude: 55.736382, longitude: -5.40416699999992 }, Coordinate { latitude: 55.708328, longitude: -5.44444499999997 }, Coordinate { latitude: 55.705276, longitude: -5.44749999999999 }, Coordinate { latitude: 55.686943, longitude: -5.45333399999998 }, Coordinate { latitude: 55.6844410000001, longitude: -5.45694399999996 }, Coordinate { latitude: 55.6686100000001, longitude: -5.46888899999993 }, Coordinate { latitude: 55.6430510000001, longitude: -5.48638899999997 }, Coordinate { latitude: 55.414398, longitude: -5.55519699999996 }, Coordinate { latitude: 55.398331, longitude: -5.53527799999995 }, Coordinate { latitude: 55.3955539999999, longitude: -5.53277799999995 }, Coordinate { latitude: 55.3652730000001, longitude: -5.51583399999998 }, Coordinate { latitude: 55.3616640000001, longitude: -5.514723 }, Coordinate { latitude: 55.352219, longitude: -5.523056 }, Coordinate { latitude: 55.340553, longitude: -5.53527799999995 }, Coordinate { latitude: 55.316666, longitude: -5.56694499999998 }, Coordinate { latitude: 55.3058320000001, longitude: -5.59583399999997 }, Coordinate { latitude: 55.2922209999999, longitude: -5.73777899999993 }, Coordinate { latitude: 55.2919390000001, longitude: -5.752501 }, Coordinate { latitude: 55.2936100000001, longitude: -5.76583399999993 }, Coordinate { latitude: 55.296661, longitude: -5.77749999999992 }, Coordinate { latitude: 55.3013839999999, longitude: -5.78583300000003 }, Coordinate { latitude: 55.3049930000001, longitude: -5.787778 }, Coordinate { latitude: 55.3124920000001, longitude: -5.79000099999996 }, Coordinate { latitude: 55.3602750000001, longitude: -5.79527899999999 }, Coordinate { latitude: 55.3733290000001, longitude: -5.79583399999996 }, Coordinate { latitude: 55.386108, longitude: -5.79499999999996 }, Coordinate { latitude: 55.3902740000001, longitude: -5.793612 }, Coordinate { latitude: 55.396385, longitude: -5.787778 }, Coordinate { latitude: 55.417496, longitude: -5.75916699999999 }, Coordinate { latitude: 55.4313890000001, longitude: -5.72750099999996 }, Coordinate { latitude: 55.436661, longitude: -5.72111099999995 }, Coordinate { latitude: 55.440277, longitude: -5.71888899999999 }, Coordinate { latitude: 55.4488830000001, longitude: -5.71638999999999 }, Coordinate { latitude: 55.5149989999999, longitude: -5.71805599999999 }, Coordinate { latitude: 55.5886080000001, longitude: -5.70166699999993 }, Coordinate { latitude: 55.661659, longitude: -5.66916800000001 }, Coordinate { latitude: 55.7586059999999, longitude: -5.60777899999994 }, Coordinate { latitude: 55.7599950000001, longitude: -5.61194499999993 }, Coordinate { latitude: 55.7813869999999, longitude: -5.64749999999998 }, Coordinate { latitude: 55.803604, longitude: -5.67222299999997 }, Coordinate { latitude: 55.806938, longitude: -5.67416700000001 }, Coordinate { latitude: 55.8872720000001, longitude: -5.67672299999998 }, Coordinate { latitude: 55.8896060000001, longitude: -5.67722299999997 }, Coordinate { latitude: 55.8994410000001, longitude: -5.67788899999994 }, Coordinate { latitude: 55.911774, longitude: -5.67588899999993 }, Coordinate { latitude: 55.9152760000001, longitude: -5.67188899999996 }, Coordinate { latitude: 55.919273, longitude: -5.66438999999997 }, Coordinate { latitude: 55.924942, longitude: -5.65488900000003 }, Coordinate { latitude: 55.9661100000001, longitude: -5.63361199999997 }, Coordinate { latitude: 56.0116650000001, longitude: -5.58166699999992 }, Coordinate { latitude: 56.0147170000001, longitude: -5.57861100000002 }, Coordinate { latitude: 56.0372160000001, longitude: -5.57055599999995 }, Coordinate { latitude: 56.038055, longitude: -5.57611200000002 }, Coordinate { latitude: 56.037498, longitude: -5.58277800000002 }, Coordinate { latitude: 56.032219, longitude: -5.59750099999997 }, Coordinate { latitude: 56.0205540000001, longitude: -5.62555600000002 }, Coordinate { latitude: 55.983551, longitude: -5.65955599999995 }, Coordinate { latitude: 55.9817160000001, longitude: -5.66122299999995 }, Coordinate { latitude: 55.974384, longitude: -5.66805599999992 }, Coordinate { latitude: 55.972717, longitude: -5.67022199999997 }, Coordinate { latitude: 55.972389, longitude: -5.67422299999993 }, Coordinate { latitude: 55.973385, longitude: -5.67755599999998 }, Coordinate { latitude: 55.9750520000001, longitude: -5.67938899999996 }, Coordinate { latitude: 55.9892200000001, longitude: -5.67988899999995 }, Coordinate { latitude: 55.9913860000001, longitude: -5.67972299999997 }, Coordinate { latitude: 55.9977190000001, longitude: -5.67588899999993 }, Coordinate { latitude: 56.043053, longitude: -5.642222 }, Coordinate { latitude: 56.0519410000001, longitude: -5.63250099999999 }, Coordinate { latitude: 56.076385, longitude: -5.60138899999998 }, Coordinate { latitude: 56.113327, longitude: -5.563334 }, Coordinate { latitude: 56.1627730000001, longitude: -5.52111100000002 }, Coordinate { latitude: 56.166939, longitude: -5.518889 }, Coordinate { latitude: 56.1816640000001, longitude: -5.51166699999993 }, Coordinate { latitude: 56.1858290000001, longitude: -5.51194500000003 }, Coordinate { latitude: 56.187492, longitude: -5.51666699999998 }, Coordinate { latitude: 56.1861040000001, longitude: -5.52277899999996 }, Coordinate { latitude: 56.1824950000001, longitude: -5.53222299999999 }, Coordinate { latitude: 56.1694410000001, longitude: -5.55888900000002 }, Coordinate { latitude: 56.159996, longitude: -5.57388999999995 }, Coordinate { latitude: 56.159721, longitude: -5.59777800000001 }, Coordinate { latitude: 56.252777, longitude: -5.59666699999997 }, Coordinate { latitude: 56.2611080000001, longitude: -5.59638999999999 }, Coordinate { latitude: 56.324715, longitude: -5.57361099999997 }, Coordinate { latitude: 56.33194, longitude: -5.56916699999999 }, Coordinate { latitude: 56.3736040000001, longitude: -5.52611199999996 }, Coordinate { latitude: 56.381943, longitude: -5.52555599999999 }, Coordinate { latitude: 56.3858260000001, longitude: -5.52444499999996 }, Coordinate { latitude: 56.3894420000001, longitude: -5.52111100000002 }, Coordinate { latitude: 56.422329, longitude: -5.43722300000002 }, Coordinate { latitude: 56.4288290000001, longitude: -5.428223 }, Coordinate { latitude: 56.432999, longitude: -5.42055599999998 }, Coordinate { latitude: 56.436161, longitude: -5.33155599999998 }, Coordinate { latitude: 56.4353290000001, longitude: -5.32372299999997 }, Coordinate { latitude: 56.4296610000001, longitude: -5.30855600000001 }, Coordinate { latitude: 56.436386, longitude: -5.24166700000001 }, Coordinate { latitude: 56.4355550000001, longitude: -5.23583399999995 }, Coordinate { latitude: 56.4358290000001, longitude: -5.22083399999997 }, Coordinate { latitude: 56.4388890000001, longitude: -5.210556 }, Coordinate { latitude: 56.4430540000001, longitude: -5.20166699999993 }, Coordinate { latitude: 56.4483260000001, longitude: -5.19333399999994 }, Coordinate { latitude: 56.484993, longitude: -5.13555600000001 }, Coordinate { latitude: 56.4955520000001, longitude: -5.12055600000002 }, Coordinate { latitude: 56.507774, longitude: -5.10777899999999 }, Coordinate { latitude: 56.5572200000001, longitude: -5.06861099999998 }, Coordinate { latitude: 56.560555, longitude: -5.06638900000002 }, Coordinate { latitude: 56.562775, longitude: -5.06944499999997 }, Coordinate { latitude: 56.5622180000001, longitude: -5.07611199999997 }, Coordinate { latitude: 56.559715, longitude: -5.08083299999998 }, Coordinate { latitude: 56.554443, longitude: -5.08750099999992 }, Coordinate { latitude: 56.5447160000001, longitude: -5.09583400000002 }, Coordinate { latitude: 56.529442, longitude: -5.10388899999998 }, Coordinate { latitude: 56.512772, longitude: -5.11555599999997 }, Coordinate { latitude: 56.461937, longitude: -5.19111199999998 }, Coordinate { latitude: 56.454163, longitude: -5.203056 }, Coordinate { latitude: 56.4519420000001, longitude: -5.21444500000001 }, Coordinate { latitude: 56.450829, longitude: -5.22888899999998 }, Coordinate { latitude: 56.4511110000001, longitude: -5.23527799999994 }, Coordinate { latitude: 56.474331, longitude: -5.368334 }, Coordinate { latitude: 56.478664, longitude: -5.39866699999993 }, Coordinate { latitude: 56.5211179999999, longitude: -5.37717799999996 }, Coordinate { latitude: 56.5149540000001, longitude: -5.36351200000001 }, Coordinate { latitude: 56.515453, longitude: -5.34367800000001 }, Coordinate { latitude: 56.5157849999999, longitude: -5.33901200000003 }, Coordinate { latitude: 56.517452, longitude: -5.33234499999998 }, Coordinate { latitude: 56.550278, longitude: -5.25305600000002 }, Coordinate { latitude: 56.5527730000001, longitude: -5.249167 }, Coordinate { latitude: 56.555832, longitude: -5.24638900000002 }, Coordinate { latitude: 56.5602720000001, longitude: -5.24555600000002 }, Coordinate { latitude: 56.5602720000001, longitude: -5.25305600000002 }, Coordinate { latitude: 56.559494, longitude: -5.312389 }, Coordinate { latitude: 56.558163, longitude: -5.31555600000002 }, Coordinate { latitude: 56.553829, longitude: -5.32255600000002 }, Coordinate { latitude: 56.5493280000001, longitude: -5.33372200000002 }, Coordinate { latitude: 56.547165, longitude: -5.33955600000002 }, Coordinate { latitude: 56.5454980000001, longitude: -5.34638899999993 }, Coordinate { latitude: 56.5454980000001, longitude: -5.35138899999993 }, Coordinate { latitude: 56.547165, longitude: -5.35872299999994 }, Coordinate { latitude: 56.5561640000001, longitude: -5.37622299999992 }, Coordinate { latitude: 56.562328, longitude: -5.37188899999995 }, Coordinate { latitude: 56.5830540000001, longitude: -5.38305599999995 }, Coordinate { latitude: 56.6566620000001, longitude: -5.31472300000002 }, Coordinate { latitude: 56.712219, longitude: -5.24222300000002 }, Coordinate { latitude: 56.7599950000001, longitude: -5.17638999999997 }, Coordinate { latitude: 56.792496, longitude: -5.13388900000001 }, Coordinate { latitude: 56.795555, longitude: -5.13083399999999 }, Coordinate { latitude: 56.812775, longitude: -5.12166699999995 }, Coordinate { latitude: 56.8166660000001, longitude: -5.12000099999995 }, Coordinate { latitude: 56.799164, longitude: -5.15444499999995 }, Coordinate { latitude: 56.7763820000001, longitude: -5.18888999999996 }, Coordinate { latitude: 56.743332, longitude: -5.23416699999996 }, Coordinate { latitude: 56.6619420000001, longitude: -5.36333400000001 }, Coordinate { latitude: 56.54055, longitude: -5.56388999999996 }, Coordinate { latitude: 56.5241620000001, longitude: -5.59277800000001 }, Coordinate { latitude: 56.51944, longitude: -5.601945 }, Coordinate { latitude: 56.4938890000001, longitude: -5.67694499999999 }, Coordinate { latitude: 56.5091630000001, longitude: -5.68972299999996 }, Coordinate { latitude: 56.513611, longitude: -5.69749999999993 }, Coordinate { latitude: 56.538055, longitude: -5.79055599999998 }, Coordinate { latitude: 56.542221, longitude: -5.82666699999999 }, Coordinate { latitude: 56.553329, longitude: -5.88416699999993 }, Coordinate { latitude: 56.5569380000001, longitude: -5.895556 }, Coordinate { latitude: 56.5697170000001, longitude: -5.93055600000002 }, Coordinate { latitude: 56.5766600000001, longitude: -5.94277899999997 }, Coordinate { latitude: 56.6113820000001, longitude: -5.99583299999995 }, Coordinate { latitude: 56.619438, longitude: -6.00722300000001 }, Coordinate { latitude: 56.6255490000001, longitude: -6.01139000000001 }, Coordinate { latitude: 56.6294399999999, longitude: -6.01111100000003 }, Coordinate { latitude: 56.6374970000001, longitude: -6.00833399999999 }, Coordinate { latitude: 56.6430510000001, longitude: -6.00083399999994 }, Coordinate { latitude: 56.6474990000001, longitude: -5.99277799999999 }, Coordinate { latitude: 56.649437, longitude: -5.98749999999995 }, Coordinate { latitude: 56.651382, longitude: -5.97472299999998 }, Coordinate { latitude: 56.6566620000001, longitude: -5.88261199999999 }, Coordinate { latitude: 56.6827770000001, longitude: -5.69916699999993 }, Coordinate { latitude: 56.680275, longitude: -5.64861199999996 }, Coordinate { latitude: 56.6819380000001, longitude: -5.61249999999995 }, Coordinate { latitude: 56.6855550000001, longitude: -5.55611099999999 }, Coordinate { latitude: 56.688332, longitude: -5.54500000000002 }, Coordinate { latitude: 56.6919400000001, longitude: -5.54694499999994 }, Coordinate { latitude: 56.6941600000001, longitude: -5.55139000000003 }, Coordinate { latitude: 56.7116620000001, longitude: -5.73944499999993 }, Coordinate { latitude: 56.711937, longitude: -5.76222199999995 }, Coordinate { latitude: 56.7108310000001, longitude: -5.76972299999994 }, Coordinate { latitude: 56.707771, longitude: -5.77944500000001 }, Coordinate { latitude: 56.7013850000001, longitude: -5.792778 }, Coordinate { latitude: 56.6915510000001, longitude: -5.82622300000003 }, Coordinate { latitude: 56.6817170000001, longitude: -5.84205600000001 }, Coordinate { latitude: 56.6800500000001, longitude: -5.84872199999995 }, Coordinate { latitude: 56.673882, longitude: -5.91916799999996 }, Coordinate { latitude: 56.6797180000001, longitude: -6.19138900000002 }, Coordinate { latitude: 56.6841660000001, longitude: -6.20916699999998 }, Coordinate { latitude: 56.694443, longitude: -6.22472299999993 }, Coordinate { latitude: 56.6999970000001, longitude: -6.23083400000002 }, Coordinate { latitude: 56.710274, longitude: -6.23500100000001 }, Coordinate { latitude: 56.7149960000001, longitude: -6.23527799999994 }, Coordinate { latitude: 56.719162, longitude: -6.23500100000001 }, Coordinate { latitude: 56.722496, longitude: -6.23277899999994 }, Coordinate { latitude: 56.7477720000001, longitude: -6.19389000000001 }, Coordinate { latitude: 56.75, longitude: -6.19027799999992 }, Coordinate { latitude: 56.757774, longitude: -6.13999999999999 }, Coordinate { latitude: 56.7802730000001, longitude: -5.96694500000001 }, Coordinate { latitude: 56.781662, longitude: -5.95361099999997 }, Coordinate { latitude: 56.779999, longitude: -5.94861099999997 }, Coordinate { latitude: 56.7755510000001, longitude: -5.94027799999998 }, Coordinate { latitude: 56.75666, longitude: -5.90500099999997 }, Coordinate { latitude: 56.7427750000001, longitude: -5.86750000000001 }, Coordinate { latitude: 56.741943, longitude: -5.85333300000002 }, Coordinate { latitude: 56.746941, longitude: -5.84583400000002 }, Coordinate { latitude: 56.789162, longitude: -5.79861199999999 }, Coordinate { latitude: 56.794441, longitude: -5.80555600000002 }, Coordinate { latitude: 56.803604, longitude: -5.83944499999996 }, Coordinate { latitude: 56.807777, longitude: -5.84972299999993 }, Coordinate { latitude: 56.8130490000001, longitude: -5.85638899999992 }, Coordinate { latitude: 56.815826, longitude: -5.85861199999999 }, Coordinate { latitude: 56.8205490000001, longitude: -5.85888999999992 }, Coordinate { latitude: 56.824715, longitude: -5.85805599999992 }, Coordinate { latitude: 56.827774, longitude: -5.854445 }, Coordinate { latitude: 56.8294369999999, longitude: -5.85000000000002 }, Coordinate { latitude: 56.839554, longitude: -5.78583400000002 }, Coordinate { latitude: 56.842499, longitude: -5.753334 }, Coordinate { latitude: 56.8419420000001, longitude: -5.745001 }, Coordinate { latitude: 56.839165, longitude: -5.73305599999992 }, Coordinate { latitude: 56.8394390000001, longitude: -5.71805599999999 }, Coordinate { latitude: 56.864716, longitude: -5.66472199999993 }, Coordinate { latitude: 56.868889, longitude: -5.66083300000003 }, Coordinate { latitude: 56.8716660000001, longitude: -5.66305599999993 }, Coordinate { latitude: 56.8761060000001, longitude: -5.67250100000001 }, Coordinate { latitude: 56.893608, longitude: -5.73889000000003 }, Coordinate { latitude: 56.8938830000001, longitude: -5.746667 }, Coordinate { latitude: 56.892494, longitude: -5.76750099999992 }, Coordinate { latitude: 56.885551, longitude: -5.81805600000001 }, Coordinate { latitude: 56.8794400000001, longitude: -5.86527799999999 }, Coordinate { latitude: 56.8786090000001, longitude: -5.87861199999998 }, Coordinate { latitude: 56.8794400000001, longitude: -5.88694500000003 }, Coordinate { latitude: 56.886108, longitude: -5.91722299999998 }, Coordinate { latitude: 56.8880540000001, longitude: -5.92194499999994 }, Coordinate { latitude: 57.0008320000001, longitude: -5.829722 }, Coordinate { latitude: 57.006104, longitude: -5.82194500000003 }, Coordinate { latitude: 57.0113830000001, longitude: -5.80611099999993 }, Coordinate { latitude: 57.0136110000001, longitude: -5.79416799999996 }, Coordinate { latitude: 57.01022, longitude: -5.76344499999999 }, Coordinate { latitude: 57.011719, longitude: -5.75111199999998 }, Coordinate { latitude: 57.0122180000001, longitude: -5.73794499999997 }, Coordinate { latitude: 57.011051, longitude: -5.73494499999993 }, Coordinate { latitude: 57.009556, longitude: -5.73311199999995 }, Coordinate { latitude: 57.0035550000001, longitude: -5.72894499999995 }, Coordinate { latitude: 56.9967190000001, longitude: -5.72227799999996 }, Coordinate { latitude: 56.9891660000001, longitude: -5.69722300000001 }, Coordinate { latitude: 56.979721, longitude: -5.67166700000001 }, Coordinate { latitude: 56.9761050000001, longitude: -5.661112 }, Coordinate { latitude: 56.9727710000001, longitude: -5.64888999999994 }, Coordinate { latitude: 56.971664, longitude: -5.64333299999998 }, Coordinate { latitude: 56.9730530000001, longitude: -5.62972300000001 }, Coordinate { latitude: 56.979996, longitude: -5.57916699999993 }, Coordinate { latitude: 56.9822160000001, longitude: -5.56611199999998 }, Coordinate { latitude: 56.9894410000001, longitude: -5.53805599999993 }, Coordinate { latitude: 56.9938890000001, longitude: -5.52388999999999 }, Coordinate { latitude: 56.9963840000001, longitude: -5.52027800000002 }, Coordinate { latitude: 56.9997180000001, longitude: -5.522223 }, Coordinate { latitude: 56.999443, longitude: -5.52972299999999 }, Coordinate { latitude: 56.995277, longitude: -5.54750100000001 }, Coordinate { latitude: 56.991104, longitude: -5.55639000000002 }, Coordinate { latitude: 56.9897160000001, longitude: -5.56916699999999 }, Coordinate { latitude: 56.9847180000001, longitude: -5.61611199999993 }, Coordinate { latitude: 56.9849930000001, longitude: -5.63139000000001 }, Coordinate { latitude: 56.991943, longitude: -5.65388999999993 }, Coordinate { latitude: 57.0455549999999, longitude: -5.77361200000001 }, Coordinate { latitude: 57.0494380000001, longitude: -5.78416700000002 }, Coordinate { latitude: 57.0519410000001, longitude: -5.78722299999998 }, Coordinate { latitude: 57.05555, longitude: -5.78916699999996 }, Coordinate { latitude: 57.0594410000001, longitude: -5.788611 }, Coordinate { latitude: 57.0680540000001, longitude: -5.78583300000003 }, Coordinate { latitude: 57.078049, longitude: -5.77861100000001 }, Coordinate { latitude: 57.083328, longitude: -5.77194500000002 }, Coordinate { latitude: 57.113052, longitude: -5.72472299999998 }, Coordinate { latitude: 57.1109390000001, longitude: -5.69161200000002 }, Coordinate { latitude: 57.115944, longitude: -5.65294499999999 }, Coordinate { latitude: 57.1162719999999, longitude: -5.64927799999998 }, Coordinate { latitude: 57.112606, longitude: -5.62444499999992 }, Coordinate { latitude: 57.108608, longitude: -5.61644499999994 }, Coordinate { latitude: 57.103439, longitude: -5.61161199999992 }, Coordinate { latitude: 57.097496, longitude: -5.57749999999993 }, Coordinate { latitude: 57.0924990000001, longitude: -5.55944499999998 }, Coordinate { latitude: 57.088608, longitude: -5.54083300000002 }, Coordinate { latitude: 57.0877760000001, longitude: -5.53333399999997 }, Coordinate { latitude: 57.0880510000001, longitude: -5.518056 }, Coordinate { latitude: 57.1058270000001, longitude: -5.39972299999999 }, Coordinate { latitude: 57.109718, longitude: -5.40083399999992 }, Coordinate { latitude: 57.1124950000001, longitude: -5.40388999999999 }, Coordinate { latitude: 57.114441, longitude: -5.40777800000001 }, Coordinate { latitude: 57.1177749999999, longitude: -5.42083399999996 }, Coordinate { latitude: 57.1183320000001, longitude: -5.44361099999992 }, Coordinate { latitude: 57.116661, longitude: -5.45722299999994 }, Coordinate { latitude: 57.112221, longitude: -5.48166800000001 }, Coordinate { latitude: 57.116386, longitude: -5.55027899999999 }, Coordinate { latitude: 57.155941, longitude: -5.63961199999994 }, Coordinate { latitude: 57.157944, longitude: -5.64611099999996 }, Coordinate { latitude: 57.1596070000001, longitude: -5.64827799999995 }, Coordinate { latitude: 57.1616100000001, longitude: -5.64961099999994 }, Coordinate { latitude: 57.1644440000001, longitude: -5.64911199999995 }, Coordinate { latitude: 57.2349930000001, longitude: -5.64611099999996 }, Coordinate { latitude: 57.239773, longitude: -5.61266699999993 }, Coordinate { latitude: 57.242607, longitude: -5.60816699999992 }, Coordinate { latitude: 57.2547720000001, longitude: -5.56066700000002 }, Coordinate { latitude: 57.256775, longitude: -5.55016699999999 }, Coordinate { latitude: 57.2561040000001, longitude: -5.54683399999999 }, Coordinate { latitude: 57.248436, longitude: -5.54083300000002 }, Coordinate { latitude: 57.246605, longitude: -5.5385 }, Coordinate { latitude: 57.238884, longitude: -5.49472199999997 }, Coordinate { latitude: 57.231384, longitude: -5.481112 }, Coordinate { latitude: 57.2277759999999, longitude: -5.47250100000002 }, Coordinate { latitude: 57.2213820000001, longitude: -5.44972200000001 }, Coordinate { latitude: 57.2180480000001, longitude: -5.42833399999995 }, Coordinate { latitude: 57.219719, longitude: -5.42194499999994 }, Coordinate { latitude: 57.2294390000001, longitude: -5.40611200000001 }, Coordinate { latitude: 57.232498, longitude: -5.40416699999992 }, Coordinate { latitude: 57.277443, longitude: -5.51266699999996 }, Coordinate { latitude: 57.284107, longitude: -5.571167 }, Coordinate { latitude: 57.3304860000001, longitude: -5.59884499999998 }, Coordinate { latitude: 57.3318180000001, longitude: -5.57784499999997 }, Coordinate { latitude: 57.332485, longitude: -5.57351199999994 }, Coordinate { latitude: 57.359161, longitude: -5.520556 }, Coordinate { latitude: 57.370827, longitude: -5.49249999999995 }, Coordinate { latitude: 57.38694, longitude: -5.46277799999996 }, Coordinate { latitude: 57.389999, longitude: -5.45888899999994 }, Coordinate { latitude: 57.396111, longitude: -5.45277799999997 }, Coordinate { latitude: 57.412773, longitude: -5.44861099999997 }, Coordinate { latitude: 57.4174960000001, longitude: -5.44833399999999 }, Coordinate { latitude: 57.4202730000001, longitude: -5.45027799999997 }, Coordinate { latitude: 57.421661, longitude: -5.45777799999996 }, Coordinate { latitude: 57.4199980000001, longitude: -5.46222299999994 }, Coordinate { latitude: 57.4011080000001, longitude: -5.50333399999994 }, Coordinate { latitude: 57.370552, longitude: -5.63255600000002 }, Coordinate { latitude: 57.34333, longitude: -5.75111199999998 }, Coordinate { latitude: 57.3399960000001, longitude: -5.76944400000002 }, Coordinate { latitude: 57.3402710000001, longitude: -5.77805599999994 }, Coordinate { latitude: 57.3438869999999, longitude: -5.788611 }, Coordinate { latitude: 57.3611070000001, longitude: -5.81694499999992 }, Coordinate { latitude: 57.363884, longitude: -5.81916699999999 }, Coordinate { latitude: 57.450829, longitude: -5.86000100000001 }, Coordinate { latitude: 57.467773, longitude: -5.86694499999999 }, Coordinate { latitude: 57.479164, longitude: -5.87138899999997 }, Coordinate { latitude: 57.491661, longitude: -5.87055599999997 }, Coordinate { latitude: 57.496109, longitude: -5.869167 }, Coordinate { latitude: 57.547775, longitude: -5.85111099999995 }, Coordinate { latitude: 57.5516660000001, longitude: -5.84972299999993 }, Coordinate { latitude: 57.572777, longitude: -5.83972299999994 }, Coordinate { latitude: 57.5783309999999, longitude: -5.82361100000003 }, Coordinate { latitude: 57.5797200000001, longitude: -5.8175 }, Coordinate { latitude: 57.579437, longitude: -5.81083399999994 }, Coordinate { latitude: 57.5700000000001, longitude: -5.77694500000001 }, Coordinate { latitude: 57.552498, longitude: -5.75027799999998 }, Coordinate { latitude: 57.5441670000001, longitude: -5.74972200000002 }, Coordinate { latitude: 57.509438, longitude: -5.65555599999993 }, Coordinate { latitude: 57.508049, longitude: -5.65055599999994 }, Coordinate { latitude: 57.5086059999999, longitude: -5.64277799999996 }, Coordinate { latitude: 57.524719, longitude: -5.62000099999995 }, Coordinate { latitude: 57.528328, longitude: -5.53083399999997 }, Coordinate { latitude: 57.531662, longitude: -5.51166699999993 }, Coordinate { latitude: 57.5347209999999, longitude: -5.50861200000003 }, Coordinate { latitude: 57.5474930000001, longitude: -5.51777800000002 }, Coordinate { latitude: 57.5494380000001, longitude: -5.52166699999998 }, Coordinate { latitude: 57.5522159999999, longitude: -5.53527799999995 }, Coordinate { latitude: 57.5522159999999, longitude: -5.64361199999996 }, Coordinate { latitude: 57.5483320000001, longitude: -5.65361099999996 }, Coordinate { latitude: 57.54583, longitude: -5.65638899999993 }, Coordinate { latitude: 57.5447160000001, longitude: -5.66250000000002 }, Coordinate { latitude: 57.54583, longitude: -5.66916800000001 }, Coordinate { latitude: 57.54805, longitude: -5.67416700000001 }, Coordinate { latitude: 57.559441, longitude: -5.69555600000001 }, Coordinate { latitude: 57.6377720000001, longitude: -5.81027799999993 }, Coordinate { latitude: 57.6413879999999, longitude: -5.81138900000002 }, Coordinate { latitude: 57.817215, longitude: -5.8175 }, Coordinate { latitude: 57.8216630000001, longitude: -5.81666799999999 }, Coordinate { latitude: 57.8527760000001, longitude: -5.80361199999993 }, Coordinate { latitude: 57.8549960000001, longitude: -5.79916699999995 }, Coordinate { latitude: 57.864716, longitude: -5.76694500000002 }, Coordinate { latitude: 57.8674930000001, longitude: -5.755 }, Coordinate { latitude: 57.8694380000001, longitude: -5.71694499999995 }, Coordinate { latitude: 57.8530500000001, longitude: -5.69661100000002 }, Coordinate { latitude: 57.850883, longitude: -5.69077800000002 }, Coordinate { latitude: 57.848217, longitude: -5.68561099999999 }, Coordinate { latitude: 57.8463860000001, longitude: -5.68327900000003 }, Coordinate { latitude: 57.844219, longitude: -5.68244499999997 }, Coordinate { latitude: 57.7916640000001, longitude: -5.664445 }, Coordinate { latitude: 57.7861100000001, longitude: -5.66166700000002 }, Coordinate { latitude: 57.7738880000001, longitude: -5.64111099999997 }, Coordinate { latitude: 57.764999, longitude: -5.61472200000003 }, Coordinate { latitude: 57.765274, longitude: -5.60722299999998 }, Coordinate { latitude: 57.7672200000001, longitude: -5.60250099999996 }, Coordinate { latitude: 57.817497, longitude: -5.58222299999994 }, Coordinate { latitude: 57.8213880000001, longitude: -5.58083299999993 }, Coordinate { latitude: 57.829994, longitude: -5.58055599999994 }, Coordinate { latitude: 57.833328, longitude: -5.58277800000002 }, Coordinate { latitude: 57.8436050000001, longitude: -5.59750099999997 }, Coordinate { latitude: 57.8461070000001, longitude: -5.60166699999996 }, Coordinate { latitude: 57.852219, longitude: -5.62555600000002 }, Coordinate { latitude: 57.8643880000001, longitude: -5.63466699999998 }, Coordinate { latitude: 57.8753810000001, longitude: -5.644001 }, Coordinate { latitude: 57.8777160000001, longitude: -5.64466700000003 }, Coordinate { latitude: 57.883385, longitude: -5.64433300000002 }, Coordinate { latitude: 57.8858830000001, longitude: -5.64350000000002 }, Coordinate { latitude: 57.899719, longitude: -5.64444399999996 }, Coordinate { latitude: 57.908882, longitude: -5.63555600000001 }, Coordinate { latitude: 57.9141620000001, longitude: -5.62805600000002 }, Coordinate { latitude: 57.9236070000001, longitude: -5.61111199999993 }, Coordinate { latitude: 57.858887, longitude: -5.45749999999998 }, Coordinate { latitude: 57.8983310000001, longitude: -5.43444499999993 }, Coordinate { latitude: 57.900833, longitude: -5.43055600000002 }, Coordinate { latitude: 57.9024960000001, longitude: -5.42499999999995 }, Coordinate { latitude: 57.92083, longitude: -5.33861199999996 }, Coordinate { latitude: 57.900833, longitude: -5.21750099999997 }, Coordinate { latitude: 57.8694380000001, longitude: -5.12750099999994 }, Coordinate { latitude: 57.8594440000001, longitude: -5.11194499999999 }, Coordinate { latitude: 57.85083, longitude: -5.102778 }, Coordinate { latitude: 57.86805, longitude: -5.09833300000003 }, Coordinate { latitude: 57.9483260000001, longitude: -5.18944499999998 }, Coordinate { latitude: 57.9530490000001, longitude: -5.19722299999995 }, Coordinate { latitude: 57.9547200000001, longitude: -5.203056 }, Coordinate { latitude: 57.9711070000001, longitude: -5.26277799999997 }, Coordinate { latitude: 58.031105, longitude: -5.398056 }, Coordinate { latitude: 58.0427700000001, longitude: -5.41694499999994 }, Coordinate { latitude: 58.06694, longitude: -5.44805600000001 }, Coordinate { latitude: 58.072777, longitude: -5.45416699999998 }, Coordinate { latitude: 58.0763850000001, longitude: -5.45527799999996 }, Coordinate { latitude: 58.080551, longitude: -5.45388899999995 }, Coordinate { latitude: 58.0877760000001, longitude: -5.44916699999999 }, Coordinate { latitude: 58.093887, longitude: -5.44305600000001 }, Coordinate { latitude: 58.096382, longitude: -5.43861199999992 }, Coordinate { latitude: 58.09861, longitude: -5.42666699999995 }, Coordinate { latitude: 58.097771, longitude: -5.41916799999996 }, Coordinate { latitude: 58.094162, longitude: -5.40833399999997 }, Coordinate { latitude: 58.0836110000001, longitude: -5.38416699999993 }, Coordinate { latitude: 58.076111, longitude: -5.37194499999998 }, Coordinate { latitude: 58.064438, longitude: -5.31944499999992 }, Coordinate { latitude: 58.0638890000001, longitude: -5.31083399999994 }, Coordinate { latitude: 58.0666659999999, longitude: -5.29750099999995 }, Coordinate { latitude: 58.070274, longitude: -5.28916700000002 }, Coordinate { latitude: 58.073326, longitude: -5.28500100000002 }, Coordinate { latitude: 58.076111, longitude: -5.28138899999993 }, Coordinate { latitude: 58.07972, longitude: -5.27972299999993 }, Coordinate { latitude: 58.117218, longitude: -5.27388999999994 }, Coordinate { latitude: 58.148605, longitude: -5.27444500000001 }, Coordinate { latitude: 58.1488880000001, longitude: -5.29083300000002 }, Coordinate { latitude: 58.1508329999999, longitude: -5.29750099999995 }, Coordinate { latitude: 58.2424930000001, longitude: -5.396389 }, Coordinate { latitude: 58.2491610000001, longitude: -5.39888999999999 }, Coordinate { latitude: 58.2533260000001, longitude: -5.39916699999992 }, Coordinate { latitude: 58.257217, longitude: -5.39611100000002 }, Coordinate { latitude: 58.2594380000001, longitude: -5.39222199999995 }, Coordinate { latitude: 58.261108, longitude: -5.38666699999993 }, Coordinate { latitude: 58.259995, longitude: -5.37111199999998 }, Coordinate { latitude: 58.2583309999999, longitude: -5.36611199999999 }, Coordinate { latitude: 58.250832, longitude: -5.20361100000002 }, Coordinate { latitude: 58.2647170000001, longitude: -5.07166699999999 }, Coordinate { latitude: 58.26722, longitude: -5.07555599999995 }, Coordinate { latitude: 58.2688830000001, longitude: -5.08222299999994 }, Coordinate { latitude: 58.2874980000001, longitude: -5.12639000000001 }, Coordinate { latitude: 58.325272, longitude: -5.16472199999993 }, Coordinate { latitude: 58.349998, longitude: -5.17472299999991 }, Coordinate { latitude: 58.364998, longitude: -5.16888899999992 }, Coordinate { latitude: 58.5083310000001, longitude: -5.10944499999999 }, Coordinate { latitude: 58.623329, longitude: -5.00472299999996 }, Coordinate { latitude: 58.6249920000001, longitude: -4.99833399999994 }, Coordinate { latitude: 58.603607, longitude: -4.77222299999994 }, Coordinate { latitude: 58.601662, longitude: -4.76805599999994 }, Coordinate { latitude: 58.558609, longitude: -4.70166699999993 }, Coordinate { latitude: 58.5244370000001, longitude: -4.67666700000001 }, Coordinate { latitude: 58.5099950000001, longitude: -4.70194500000002 }, Coordinate { latitude: 58.4944380000001, longitude: -4.71777800000001 }, Coordinate { latitude: 58.4513850000001, longitude: -4.76111099999997 }, Coordinate { latitude: 58.4469380000001, longitude: -4.76361199999997 }, Coordinate { latitude: 58.4433290000001, longitude: -4.76444499999997 }, Coordinate { latitude: 58.442497, longitude: -4.75666699999999 }, Coordinate { latitude: 58.448326, longitude: -4.74138900000003 }, Coordinate { latitude: 58.488327, longitude: -4.66805599999992 }, Coordinate { latitude: 58.523331, longitude: -4.60388899999998 }, Coordinate { latitude: 58.529999, longitude: -4.598612 }, Coordinate { latitude: 58.5338819999999, longitude: -4.59694500000001 }, Coordinate { latitude: 58.5463870000001, longitude: -4.59805599999993 }, Coordinate { latitude: 58.553604, longitude: -4.60138899999993 }, Coordinate { latitude: 58.558052, longitude: -4.59972299999993 }, Coordinate { latitude: 58.564995, longitude: -4.59500000000003 }, Coordinate { latitude: 58.5708310000001, longitude: -4.58861200000001 }, Coordinate { latitude: 58.57444, longitude: -4.57833399999998 }, Coordinate { latitude: 58.5761110000001, longitude: -4.565001 }, Coordinate { latitude: 58.575554, longitude: -4.55611099999993 }, Coordinate { latitude: 58.567772, longitude: -4.50666699999994 }, Coordinate { latitude: 58.5611040000001, longitude: -4.47611099999995 }, Coordinate { latitude: 58.551384, longitude: -4.44083399999994 }, Coordinate { latitude: 58.546661, longitude: -4.43222199999997 }, Coordinate { latitude: 58.5397190000001, longitude: -4.42888899999997 }, Coordinate { latitude: 58.5336070000001, longitude: -4.27722299999994 }, Coordinate { latitude: 58.5552750000001, longitude: -4.080556 }, Coordinate { latitude: 58.558327, longitude: -3.90333399999992 }, Coordinate { latitude: 58.5599980000001, longitude: -3.84833299999997 }, Coordinate { latitude: 58.5666660000001, longitude: -3.78527799999995 }, Coordinate { latitude: 58.5683289999999, longitude: -3.77999999999997 }, Coordinate { latitude: 58.5927730000001, longitude: -3.730278 }, Coordinate { latitude: 58.6027760000001, longitude: -3.71416699999992 }, Coordinate { latitude: 58.6047209999999, longitude: -3.70916699999998 }, Coordinate { latitude: 58.61972, longitude: -3.66027800000001 }, Coordinate { latitude: 58.6219410000001, longitude: -3.57611100000003 }, Coordinate { latitude: 58.609161, longitude: -3.55333399999995 }, Coordinate { latitude: 58.595833, longitude: -3.37361099999993 }, Coordinate { latitude: 58.5952760000001, longitude: -3.36499999999995 }, Coordinate { latitude: 58.5977710000001, longitude: -3.36083399999995 }, Coordinate { latitude: 58.601387, longitude: -3.35833399999996 }, Coordinate { latitude: 58.6124950000001, longitude: -3.35166699999996 }, Coordinate { latitude: 58.6161040000001, longitude: -3.35083299999997 }, Coordinate { latitude: 58.6186070000001, longitude: -3.35472199999998 }, Coordinate { latitude: 58.6274950000001, longitude: -3.37333299999995 }, Coordinate { latitude: 58.6605530000001, longitude: -3.35388899999998 }, Coordinate { latitude: 58.649437, longitude: -3.17638899999997 }, Coordinate { latitude: 58.647499, longitude: -3.02555599999994 }, Coordinate { latitude: 58.6455540000001, longitude: -3.01972199999994 }, Coordinate { latitude: 58.6430510000001, longitude: -3.01583299999999 }, Coordinate { latitude: 58.633331, longitude: -3.01361099999997 }, Coordinate { latitude: 58.4544370000001, longitude: -3.05555599999997 }, Coordinate { latitude: 58.4472200000001, longitude: -3.06027799999998 }, Coordinate { latitude: 58.38166, longitude: -3.10972299999992 }, Coordinate { latitude: 58.369438, longitude: -3.12194499999998 }, Coordinate { latitude: 58.308052, longitude: -3.20249999999999 }, Coordinate { latitude: 58.304443, longitude: -3.20861099999996 }, Coordinate { latitude: 58.276939, longitude: -3.33749999999992 }, Coordinate { latitude: 58.276939, longitude: -3.35333299999996 }, Coordinate { latitude: 58.275833, longitude: -3.35972299999997 }, Coordinate { latitude: 58.273888, longitude: -3.36416699999995 }, Coordinate { latitude: 58.2647170000001, longitude: -3.38194499999992 }, Coordinate { latitude: 58.2436070000001, longitude: -3.420278 }, Coordinate { latitude: 58.226944, longitude: -3.44222299999996 }, Coordinate { latitude: 58.2191620000001, longitude: -3.44638899999995 }, Coordinate { latitude: 58.206108, longitude: -3.45583299999993 }, Coordinate { latitude: 58.1999970000001, longitude: -3.46249999999998 }, Coordinate { latitude: 58.1827769999999, longitude: -3.48333400000001 }, Coordinate { latitude: 58.164993, longitude: -3.51111099999997 }, Coordinate { latitude: 58.162498, longitude: -3.51527799999997 }, Coordinate { latitude: 58.1391600000001, longitude: -3.56611199999992 }, Coordinate { latitude: 58.089722, longitude: -3.68444499999993 }, Coordinate { latitude: 58.019997, longitude: -3.84499999999997 }, Coordinate { latitude: 57.9505540000001, longitude: -3.99694499999998 }, Coordinate { latitude: 57.9269410000001, longitude: -4.01166699999993 }, Coordinate { latitude: 57.910271, longitude: -3.99222200000003 }, Coordinate { latitude: 57.901939, longitude: -3.99111099999999 }, Coordinate { latitude: 57.867775, longitude: -4.01499999999993 }, Coordinate { latitude: 57.851944, longitude: -4.10666800000001 }, Coordinate { latitude: 57.85083, longitude: -4.12000099999995 }, Coordinate { latitude: 57.870277, longitude: -4.24305600000002 }, Coordinate { latitude: 57.895271, longitude: -4.35861199999994 }, Coordinate { latitude: 57.9002760000001, longitude: -4.36638900000003 }, Coordinate { latitude: 57.9036100000001, longitude: -4.37805600000002 }, Coordinate { latitude: 57.905273, longitude: -4.39222199999995 }, Coordinate { latitude: 57.897499, longitude: -4.39111099999997 }, Coordinate { latitude: 57.8624950000001, longitude: -4.35416699999996 }, Coordinate { latitude: 57.8583300000001, longitude: -4.34555599999999 }, Coordinate { latitude: 57.8463820000001, longitude: -4.29750100000001 }, Coordinate { latitude: 57.844162, longitude: -4.28333400000002 }, Coordinate { latitude: 57.8252720000001, longitude: -4.14972299999999 }, Coordinate { latitude: 57.814384, longitude: -4.04322300000001 }, Coordinate { latitude: 57.8074950000001, longitude: -3.92638899999997 }, Coordinate { latitude: 57.815277, longitude: -3.87472200000002 }, Coordinate { latitude: 57.82, longitude: -3.85055599999998 }, Coordinate { latitude: 57.824715, longitude: -3.84166699999992 }, Coordinate { latitude: 57.8305510000001, longitude: -3.834723 }, Coordinate { latitude: 57.845276, longitude: -3.82666699999993 }, Coordinate { latitude: 57.8513870000001, longitude: -3.82027799999997 }, Coordinate { latitude: 57.856384, longitude: -3.81138899999996 }, Coordinate { latitude: 57.859993, longitude: -3.80222199999992 }, Coordinate { latitude: 57.861107, longitude: -3.78833300000002 }, Coordinate { latitude: 57.858604, longitude: -3.77499999999998 }, Coordinate { latitude: 57.8511050000001, longitude: -3.773056 }, Coordinate { latitude: 57.8436050000001, longitude: -3.77777799999996 }, Coordinate { latitude: 57.8074950000001, longitude: -3.815834 }, Coordinate { latitude: 57.8016660000001, longitude: -3.82305599999995 }, Coordinate { latitude: 57.768608, longitude: -3.86555600000003 }, Coordinate { latitude: 57.7172160000001, longitude: -3.94416699999994 }, Coordinate { latitude: 57.712494, longitude: -3.95194500000002 }, Coordinate { latitude: 57.7024990000001, longitude: -3.96861099999995 }, Coordinate { latitude: 57.698326, longitude: -3.97777799999994 }, Coordinate { latitude: 57.695274, longitude: -3.98888899999992 }, Coordinate { latitude: 57.693054, longitude: -4.00111199999998 }, Coordinate { latitude: 57.6980510000001, longitude: -4.012 }, Coordinate { latitude: 57.699383, longitude: -4.02100000000002 }, Coordinate { latitude: 57.7033840000001, longitude: -4.02283399999993 }, Coordinate { latitude: 57.708218, longitude: -4.02050000000003 }, Coordinate { latitude: 57.711552, longitude: -4.01616699999994 }, Coordinate { latitude: 57.721382, longitude: -4.01638899999995 }, Coordinate { latitude: 57.72805, longitude: -4.01944400000002 }, Coordinate { latitude: 57.731384, longitude: -4.03111200000001 }, Coordinate { latitude: 57.726105, longitude: -4.08527899999996 }, Coordinate { latitude: 57.723885, longitude: -4.09777800000001 }, Coordinate { latitude: 57.674438, longitude: -4.29666700000001 }, Coordinate { latitude: 57.601662, longitude: -4.41638899999998 }, Coordinate { latitude: 57.5749969999999, longitude: -4.43583399999994 }, Coordinate { latitude: 57.570549, longitude: -4.42722199999997 }, Coordinate { latitude: 57.572777, longitude: -4.41472199999998 }, Coordinate { latitude: 57.5897220000001, longitude: -4.378334 }, Coordinate { latitude: 57.6077730000001, longitude: -4.34361200000001 }, Coordinate { latitude: 57.618889, longitude: -4.33027800000002 }, Coordinate { latitude: 57.628052, longitude: -4.31249999999994 }, Coordinate { latitude: 57.6552730000001, longitude: -4.25944500000003 }, Coordinate { latitude: 57.6594390000001, longitude: -4.24944499999992 }, Coordinate { latitude: 57.664993, longitude: -4.227778 }, Coordinate { latitude: 57.671387, longitude: -4.19138899999996 }, Coordinate { latitude: 57.665329, longitude: -4.08077799999995 }, Coordinate { latitude: 57.6427760000001, longitude: -4.04666699999996 }, Coordinate { latitude: 57.598328, longitude: -4.11138899999997 }, Coordinate { latitude: 57.562492, longitude: -4.17944499999993 }, Coordinate { latitude: 57.5361100000001, longitude: -4.21083399999992 }, Coordinate { latitude: 57.5155490000001, longitude: -4.22888899999998 }, Coordinate { latitude: 57.5000000000001, longitude: -4.24055600000003 }, Coordinate { latitude: 57.4933320000001, longitude: -4.23500099999995 }, Coordinate { latitude: 57.489166, longitude: -4.225278 }, Coordinate { latitude: 57.486107, longitude: -4.21305599999994 }, Coordinate { latitude: 57.485832, longitude: -4.19666699999999 }, Coordinate { latitude: 57.489441, longitude: -4.17916700000001 }, Coordinate { latitude: 57.4966660000001, longitude: -4.15888999999999 }, Coordinate { latitude: 57.5541610000001, longitude: -4.04138899999998 }, Coordinate { latitude: 57.5572200000001, longitude: -4.03833399999996 }, Coordinate { latitude: 57.625038, longitude: -3.75413700000001 }, Coordinate { latitude: 57.643883, longitude: -3.63944500000002 }, Coordinate { latitude: 57.640831, longitude: -3.64194500000002 }, Coordinate { latitude: 57.6363830000001, longitude: -3.64249999999993 }, Coordinate { latitude: 57.6341630000001, longitude: -3.63861100000003 }, Coordinate { latitude: 57.6325, longitude: -3.62444399999998 }, Coordinate { latitude: 57.6361080000001, longitude: -3.59805599999993 }, Coordinate { latitude: 57.637215, longitude: -3.59277799999995 }, Coordinate { latitude: 57.66333, longitude: -3.52222299999994 }, Coordinate { latitude: 57.673607, longitude: -3.50638899999996 }, Coordinate { latitude: 57.6761090000001, longitude: -3.503334 }, Coordinate { latitude: 57.682777, longitude: -3.49694499999998 }, Coordinate { latitude: 57.6899950000001, longitude: -3.49361099999993 }, Coordinate { latitude: 57.6936040000001, longitude: -3.49472200000002 }, Coordinate { latitude: 57.696938, longitude: -3.49722200000002 }, Coordinate { latitude: 57.7008290000001, longitude: -3.49861099999998 }, Coordinate { latitude: 57.70472, longitude: -3.4975 }, Coordinate { latitude: 57.7094420000001, longitude: -3.48805599999992 }, Coordinate { latitude: 57.7233280000001, longitude: -3.33972299999999 }, Coordinate { latitude: 57.72583, longitude: -3.28944399999995 }, Coordinate { latitude: 57.7241590000001, longitude: -3.28305599999999 }, Coordinate { latitude: 57.721107, longitude: -3.27999999999997 }, Coordinate { latitude: 57.7149960000001, longitude: -3.27611100000001 }, Coordinate { latitude: 57.70472, longitude: -3.26111100000003 }, Coordinate { latitude: 57.698326, longitude: -3.24611099999998 }, Coordinate { latitude: 57.6916660000001, longitude: -3.22333300000003 }, Coordinate { latitude: 57.6716609999999, longitude: -3.123333 }, Coordinate { latitude: 57.6655500000001, longitude: -3.08083299999998 }, Coordinate { latitude: 57.6622160000001, longitude: -3.041945 }, Coordinate { latitude: 57.6627730000001, longitude: -3.03500000000003 }, Coordinate { latitude: 57.6652760000001, longitude: -3.02249999999998 }, Coordinate { latitude: 57.6741640000001, longitude: -2.98944499999993 }, Coordinate { latitude: 57.680275, longitude: -2.96749999999992 }, Coordinate { latitude: 57.689438, longitude: -2.94249999999994 }, Coordinate { latitude: 57.696938, longitude: -2.92361099999999 }, Coordinate { latitude: 57.70694, longitude: -2.898056 }, Coordinate { latitude: 57.7058260000001, longitude: -2.852778 }, Coordinate { latitude: 57.7024990000001, longitude: -2.79055599999998 }, Coordinate { latitude: 57.701942, longitude: -2.78222199999999 }, Coordinate { latitude: 57.688049, longitude: -2.64583299999993 }, Coordinate { latitude: 57.6797180000001, longitude: -2.56999999999994 }, Coordinate { latitude: 57.6716609999999, longitude: -2.50999999999999 }, Coordinate { latitude: 57.6683269999999, longitude: -2.44444499999997 }, Coordinate { latitude: 57.6663820000001, longitude: -2.40027799999996 }, Coordinate { latitude: 57.6663820000001, longitude: -2.392222 }, Coordinate { latitude: 57.6686100000001, longitude: -2.18611099999993 }, Coordinate { latitude: 57.669998, longitude: -2.17277799999999 }, Coordinate { latitude: 57.6719440000001, longitude: -2.16722199999998 }, Coordinate { latitude: 57.6905520000001, longitude: -2.14027799999997 }, Coordinate { latitude: 57.695274, longitude: -2.13138900000001 }, Coordinate { latitude: 57.6974950000001, longitude: -2.12 }, Coordinate { latitude: 57.6994399999999, longitude: -2.07555599999995 }, Coordinate { latitude: 57.6938860000001, longitude: -2.022223 }, Coordinate { latitude: 57.6777730000001, longitude: -1.92972200000003 }, Coordinate { latitude: 57.6705550000001, longitude: -1.91833399999996 }, Coordinate { latitude: 57.621384, longitude: -1.86000000000001 }, Coordinate { latitude: 57.578606, longitude: -1.82194399999992 }, Coordinate { latitude: 57.505554, longitude: -1.78138899999999 }, Coordinate { latitude: 57.4908290000001, longitude: -1.77416699999992 }, Coordinate { latitude: 57.4580540000001, longitude: -1.77333399999992 }, Coordinate { latitude: 57.3988880000001, longitude: -1.85583400000002 }, Coordinate { latitude: 57.3324970000001, longitude: -1.95888899999994 }, Coordinate { latitude: 57.320274, longitude: -1.97194500000001 }, Coordinate { latitude: 57.313889, longitude: -1.977778 }, Coordinate { latitude: 57.218605, longitude: -2.05416700000001 }, Coordinate { latitude: 57.2041630000001, longitude: -2.061667 }, Coordinate { latitude: 57.1905520000001, longitude: -2.06583399999994 }, Coordinate { latitude: 57.1513820000001, longitude: -2.07499999999993 }, Coordinate { latitude: 57.1438830000001, longitude: -2.07361100000003 }, Coordinate { latitude: 57.134438, longitude: -2.06722299999996 }, Coordinate { latitude: 57.0702740000001, longitude: -2.09333399999997 }, Coordinate { latitude: 57.0005490000001, longitude: -2.166945 }, Coordinate { latitude: 56.9747159999999, longitude: -2.19027799999992 }, Coordinate { latitude: 56.9622189999999, longitude: -2.19638900000001 }, Coordinate { latitude: 56.945549, longitude: -2.19749999999993 }, Coordinate { latitude: 56.942215, longitude: -2.19666699999993 }, Coordinate { latitude: 56.9324950000001, longitude: -2.18972300000002 }, Coordinate { latitude: 56.922218, longitude: -2.18527799999993 }, Coordinate { latitude: 56.918053, longitude: -2.18638900000002 }, Coordinate { latitude: 56.9024960000001, longitude: -2.19416699999994 }, Coordinate { latitude: 56.867775, longitude: -2.21972199999999 }, Coordinate { latitude: 56.7988820000001, longitude: -2.31555600000002 }, Coordinate { latitude: 56.7938840000001, longitude: -2.32416699999999 }, Coordinate { latitude: 56.784439, longitude: -2.34805599999993 }, Coordinate { latitude: 56.77166, longitude: -2.38999999999993 }, Coordinate { latitude: 56.7586060000001, longitude: -2.41527799999994 }, Coordinate { latitude: 56.7152710000001, longitude: -2.47805599999998 }, Coordinate { latitude: 56.6963880000001, longitude: -2.46277800000001 }, Coordinate { latitude: 56.6996460000001, longitude: -2.44808399999999 }, Coordinate { latitude: 56.6916659999999, longitude: -2.44805599999995 }, Coordinate { latitude: 56.687218, longitude: -2.44888899999995 }, Coordinate { latitude: 56.6141660000001, longitude: -2.48861099999993 }, Coordinate { latitude: 56.578606, longitude: -2.52722299999994 }, Coordinate { latitude: 56.573608, longitude: -2.53527800000001 }, Coordinate { latitude: 56.563889, longitude: -2.55138899999997 }, Coordinate { latitude: 56.522499, longitude: -2.64083299999999 }, Coordinate { latitude: 56.4888840000001, longitude: -2.72083400000002 }, Coordinate { latitude: 56.463882, longitude: -2.89527799999996 }, Coordinate { latitude: 56.456108, longitude: -2.95861100000002 }, Coordinate { latitude: 56.4544370000001, longitude: -3.03638899999993 }, Coordinate { latitude: 56.454994, longitude: -3.04472299999998 }, Coordinate { latitude: 56.454994, longitude: -3.05194499999999 }, Coordinate { latitude: 56.4519420000001, longitude: -3.07027799999992 }, Coordinate { latitude: 56.4486080000001, longitude: -3.08083299999998 }, Coordinate { latitude: 56.3574980000001, longitude: -3.27805599999999 }, Coordinate { latitude: 56.346107, longitude: -3.26472200000001 }, Coordinate { latitude: 56.3480530000001, longitude: -3.25249999999994 }, Coordinate { latitude: 56.3588869999999, longitude: -3.19305600000001 }, Coordinate { latitude: 56.3602750000001, longitude: -3.18777799999992 }, Coordinate { latitude: 56.414162, longitude: -2.99555600000002 }, Coordinate { latitude: 56.442772, longitude: -2.93222199999997 }, Coordinate { latitude: 56.44944, longitude: -2.91916700000002 }, Coordinate { latitude: 56.450829, longitude: -2.91388899999993 }, Coordinate { latitude: 56.4522170000001, longitude: -2.90083399999997 }, Coordinate { latitude: 56.451385, longitude: -2.88444500000003 }, Coordinate { latitude: 56.44944, longitude: -2.86999999999995 }, Coordinate { latitude: 56.440277, longitude: -2.81527799999998 }, Coordinate { latitude: 56.4388890000001, longitude: -2.80888900000002 }, Coordinate { latitude: 56.4327769999999, longitude: -2.80416700000001 }, Coordinate { latitude: 56.41861, longitude: -2.79916700000001 }, Coordinate { latitude: 56.4147190000001, longitude: -2.79805599999992 }, Coordinate { latitude: 56.410828, longitude: -2.79972299999991 }, Coordinate { latitude: 56.407219, longitude: -2.80305600000003 }, Coordinate { latitude: 56.39666, longitude: -2.80944499999993 }, Coordinate { latitude: 56.3736040000001, longitude: -2.81527799999998 }, Coordinate { latitude: 56.362778, longitude: -2.813334 }, Coordinate { latitude: 56.3469390000001, longitude: -2.80416700000001 }, Coordinate { latitude: 56.3444440000001, longitude: -2.80055599999992 }, Coordinate { latitude: 56.3324970000001, longitude: -2.771389 }, Coordinate { latitude: 56.3311079999999, longitude: -2.76583299999993 }, Coordinate { latitude: 56.324715, longitude: -2.73083400000002 }, Coordinate { latitude: 56.3238830000001, longitude: -2.72333300000003 }, Coordinate { latitude: 56.324715, longitude: -2.70416699999998 }, Coordinate { latitude: 56.323326, longitude: -2.67527799999999 }, Coordinate { latitude: 56.3222200000001, longitude: -2.66888899999998 }, Coordinate { latitude: 56.3166660000001, longitude: -2.64361100000002 }, Coordinate { latitude: 56.3149950000001, longitude: -2.63888899999995 }, Coordinate { latitude: 56.312775, longitude: -2.63361099999997 }, Coordinate { latitude: 56.2838820000001, longitude: -2.58583399999998 }, Coordinate { latitude: 56.2813870000001, longitude: -2.582222 }, Coordinate { latitude: 56.2749940000001, longitude: -2.57777800000002 }, Coordinate { latitude: 56.2680510000001, longitude: -2.58277800000002 }, Coordinate { latitude: 56.265549, longitude: -2.58666699999998 }, Coordinate { latitude: 56.2169420000001, longitude: -2.67333399999995 }, Coordinate { latitude: 56.214996, longitude: -2.67805600000003 }, Coordinate { latitude: 56.2133330000001, longitude: -2.68305600000002 }, Coordinate { latitude: 56.187492, longitude: -2.78805599999998 }, Coordinate { latitude: 56.184166, longitude: -2.81999999999999 }, Coordinate { latitude: 56.1836090000001, longitude: -2.83444500000002 }, Coordinate { latitude: 56.186386, longitude: -2.84694500000001 }, Coordinate { latitude: 56.1902770000001, longitude: -2.857778 }, Coordinate { latitude: 56.198608, longitude: -2.87499999999994 }, Coordinate { latitude: 56.2005540000001, longitude: -2.88027799999992 }, Coordinate { latitude: 56.2019420000001, longitude: -2.88777800000003 }, Coordinate { latitude: 56.2049940000001, longitude: -2.91666700000002 }, Coordinate { latitude: 56.2052760000001, longitude: -2.931667 }, Coordinate { latitude: 56.202217, longitude: -2.95694400000002 }, Coordinate { latitude: 56.1947170000001, longitude: -2.976111 }, Coordinate { latitude: 56.1136090000001, longitude: -3.13555599999995 }, Coordinate { latitude: 56.1080550000001, longitude: -3.14249999999993 }, Coordinate { latitude: 56.09333, longitude: -3.15111100000001 }, Coordinate { latitude: 56.0897220000001, longitude: -3.15277800000001 }, Coordinate { latitude: 56.085548, longitude: -3.15416699999992 }, Coordinate { latitude: 56.024162, longitude: -3.34138899999999 }, Coordinate { latitude: 56.0224990000001, longitude: -3.34666700000002 }, Coordinate { latitude: 56.011108, longitude: -3.39249999999998 }, Coordinate { latitude: 56.0105510000001, longitude: -3.39916699999998 }, Coordinate { latitude: 56.0124969999999, longitude: -3.40944499999995 }, Coordinate { latitude: 56.0191650000001, longitude: -3.44111199999998 }, Coordinate { latitude: 56.034439, longitude: -3.4975 }, Coordinate { latitude: 56.053604, longitude: -3.57138900000001 }, Coordinate { latitude: 56.0549930000001, longitude: -3.58249999999998 }, Coordinate { latitude: 56.056664, longitude: -3.71972199999993 }, Coordinate { latitude: 56.05555, longitude: -3.73722299999997 }, Coordinate { latitude: 56.03083, longitude: -3.726944 }, Coordinate { latitude: 56.027496, longitude: -3.725278 }, Coordinate { latitude: 56.025551, longitude: -3.72138899999993 }, Coordinate { latitude: 56.0072170000001, longitude: -3.66638899999998 }, Coordinate { latitude: 56.005829, longitude: -3.66194499999995 }, Coordinate { latitude: 56.0049970000001, longitude: -3.64611100000002 }, Coordinate { latitude: 55.991943, longitude: -3.454722 }, Coordinate { latitude: 55.971664, longitude: -3.25472300000001 }, Coordinate { latitude: 55.9480510000001, longitude: -3.08805599999999 }, Coordinate { latitude: 55.944443, longitude: -3.06749999999994 }, Coordinate { latitude: 55.9436040000001, longitude: -3.05305599999997 }, Coordinate { latitude: 55.9494399999999, longitude: -3.01805599999994 }, Coordinate { latitude: 55.9694440000001, longitude: -2.935 }, Coordinate { latitude: 55.972496, longitude: -2.92444499999999 }, Coordinate { latitude: 55.97805, longitude: -2.91027799999995 }, Coordinate { latitude: 55.979996, longitude: -2.90638899999993 }, Coordinate { latitude: 55.988609, longitude: -2.895556 }, Coordinate { latitude: 56.0213850000001, longitude: -2.86583399999995 }, Coordinate { latitude: 56.0283280000001, longitude: -2.86833299999995 }, Coordinate { latitude: 56.031944, longitude: -2.86527799999999 }, Coordinate { latitude: 56.0511089999999, longitude: -2.83388899999994 }, Coordinate { latitude: 56.0569379999999, longitude: -2.82027799999997 }, Coordinate { latitude: 56.0602719999999, longitude: -2.79416699999996 }, Coordinate { latitude: 56.0613859999999, longitude: -2.78222199999999 }, Coordinate { latitude: 56.059715, longitude: -2.65722199999999 }, Coordinate { latitude: 56.054718, longitude: -2.63111099999998 }, Coordinate { latitude: 56.043327, longitude: -2.60055599999998 }, Coordinate { latitude: 56.002777, longitude: -2.50222300000002 }, Coordinate { latitude: 55.95694, longitude: -2.37527799999998 }, Coordinate { latitude: 55.9186100000001, longitude: -2.26027800000003 }, Coordinate { latitude: 55.885826, longitude: -2.13027799999998 }, Coordinate { latitude: 55.867218, longitude: -2.079722 }, Coordinate { latitude: 55.853607, longitude: -2.07277800000003 }, Coordinate { latitude: 55.8474960000001, longitude: -2.06833399999994 }, Coordinate { latitude: 55.839996, longitude: -2.06111099999998 }, Coordinate { latitude: 55.806107, longitude: -2.02166699999998 }, Coordinate { latitude: 55.7949980000001, longitude: -2.01361100000003 }, Coordinate { latitude: 55.780273, longitude: -2.00083399999994 }, Coordinate { latitude: 55.7566600000001, longitude: -1.97999999999996 }, Coordinate { latitude: 55.7516630000001, longitude: -1.97361100000001 }, Coordinate { latitude: 55.657219, longitude: -1.85138899999993 }, Coordinate { latitude: 55.6341629999999, longitude: -1.81972200000001 }, Coordinate { latitude: 55.631943, longitude: -1.81555600000002 }, Coordinate { latitude: 55.6308289999999, longitude: -1.80833299999995 }, Coordinate { latitude: 55.6313860000001, longitude: -1.80166699999995 }, Coordinate { latitude: 55.63694, longitude: -1.79472199999998 }, Coordinate { latitude: 55.624992, longitude: -1.74694499999998 }, Coordinate { latitude: 55.6055530000001, longitude: -1.68999999999994 }, Coordinate { latitude: 55.583054, longitude: -1.63805600000001 }, Coordinate { latitude: 55.580826, longitude: -1.63388900000001 }, Coordinate { latitude: 55.48555, longitude: -1.58138899999994 }, Coordinate { latitude: 55.481667, longitude: -1.58055599999994 }, Coordinate { latitude: 55.4197160000001, longitude: -1.57333399999993 }, Coordinate { latitude: 55.410828, longitude: -1.57555599999995 }, Coordinate { latitude: 55.403328, longitude: -1.57972199999995 }, Coordinate { latitude: 55.39666, longitude: -1.58527800000002 }, Coordinate { latitude: 55.3916630000001, longitude: -1.59305599999999 }, Coordinate { latitude: 55.3858260000001, longitude: -1.599445 }, Coordinate { latitude: 55.381943, longitude: -1.59861100000001 }, Coordinate { latitude: 55.2872160000001, longitude: -1.565834 }, Coordinate { latitude: 55.1641620000001, longitude: -1.520556 }, Coordinate { latitude: 55.149719, longitude: -1.51499999999999 }, Coordinate { latitude: 55.0897220000001, longitude: -1.48500000000001 }, Coordinate { latitude: 55.0827710000001, longitude: -1.48083400000002 }, Coordinate { latitude: 54.9994430000001, longitude: -1.412778 }, Coordinate { latitude: 54.976387, longitude: -1.38138899999996 }, Coordinate { latitude: 54.9277730000001, longitude: -1.36500000000001 }, Coordinate { latitude: 54.871384, longitude: -1.34555599999993 }, Coordinate { latitude: 54.771385, longitude: -1.30444499999999 }, Coordinate { latitude: 54.763611, longitude: -1.29749999999996 }, Coordinate { latitude: 54.6497190000001, longitude: -1.165278 }, Coordinate { latitude: 54.617218, longitude: -1.06138900000002 }, Coordinate { latitude: 54.6130519999999, longitude: -1.04388899999992 }, Coordinate { latitude: 54.570274, longitude: -0.875833 }, Coordinate { latitude: 54.479996, longitude: -0.564722000000017 }, Coordinate { latitude: 54.450272, longitude: -0.521388999999999 }, Coordinate { latitude: 54.4447170000001, longitude: -0.515556000000004 }, Coordinate { latitude: 54.376938, longitude: -0.457499999999982 }, Coordinate { latitude: 54.3502730000001, longitude: -0.436110999999926 }, Coordinate { latitude: 54.3322220000001, longitude: -0.421666999999957 }, Coordinate { latitude: 54.2727740000001, longitude: -0.393332999999984 }, Coordinate { latitude: 54.2691650000001, longitude: -0.394166999999925 }, Coordinate { latitude: 54.2658310000001, longitude: -0.392777999999964 }, Coordinate { latitude: 54.2555540000001, longitude: -0.381943999999976 }, Coordinate { latitude: 54.174438, longitude: -0.262499999999989 }, Coordinate { latitude: 54.151711, longitude: -0.200529000000017 }, Coordinate { latitude: 54.1413880000001, longitude: -0.151666999999975 }, Coordinate { latitude: 54.132217, longitude: -0.11694399999999 }, Coordinate { latitude: 54.118889, longitude: -0.0824999999999818 }, Coordinate { latitude: 54.116661, longitude: -0.0783329999999864 }, Coordinate { latitude: 54.1119380000001, longitude: -0.0749999999999886 }, Coordinate { latitude: 54.1061100000001, longitude: -0.0813889999999446 }, Coordinate { latitude: 54.098328, longitude: -0.112500000000011 }, Coordinate { latitude: 54.0955510000001, longitude: -0.136111000000028 }, Coordinate { latitude: 54.0941620000001, longitude: -0.141389000000004 }, Coordinate { latitude: 54.088051, longitude: -0.161110999999948 }, Coordinate { latitude: 54.0816650000001, longitude: -0.173888999999917 }, Coordinate { latitude: 54.054718, longitude: -0.202778000000023 }, Coordinate { latitude: 54.0483320000001, longitude: -0.208611000000019 }, Coordinate { latitude: 54.035828, longitude: -0.213332999999921 }, Coordinate { latitude: 54.026665, longitude: -0.215832999999918 }, Coordinate { latitude: 54.022499, longitude: -0.216111000000012 }, Coordinate { latitude: 54.0149990000001, longitude: -0.214999999999918 }, Coordinate { latitude: 54.0083310000001, longitude: -0.21222199999994 }, Coordinate { latitude: 53.921661, longitude: -0.171110999999939 }, Coordinate { latitude: 53.9152760000001, longitude: -0.167221999999924 }, Coordinate { latitude: 53.863884, longitude: -0.127499999999941 }, Coordinate { latitude: 53.8505550000001, longitude: -0.112777999999992 }, Coordinate { latitude: 53.8397220000001, longitude: -0.0994440000000054 }, Coordinate { latitude: 53.803055, longitude: -0.0538890000000265 }, Coordinate { latitude: 53.768608, longitude: -0.0130559999999491 }, Coordinate { latitude: 53.7052760000001, longitude: 0.0611110000000394 }, Coordinate { latitude: 53.702499, longitude: 0.0641669999999408 }, Coordinate { latitude: 53.645271, longitude: 0.126388999999961 }, Coordinate { latitude: 53.62722, longitude: 0.141111000000024 }, Coordinate { latitude: 53.614716, longitude: 0.14944400000013 }, Coordinate { latitude: 53.604721, longitude: 0.153611000000126 }, Coordinate { latitude: 53.60083, longitude: 0.154167000000086 }, Coordinate { latitude: 53.591942, longitude: 0.151944000000015 }, Coordinate { latitude: 53.584999, longitude: 0.146944000000019 }, Coordinate { latitude: 53.58194, longitude: 0.143611000000135 }, Coordinate { latitude: 53.5791629999999, longitude: 0.140556000000117 }, Coordinate { latitude: 53.564438, longitude: 0.118056000000081 }, Coordinate { latitude: 53.563049, longitude: 0.112777999999992 }, Coordinate { latitude: 53.5666659999999, longitude: 0.113888999999915 }, Coordinate { latitude: 53.5730510000001, longitude: 0.119443999999987 }, Coordinate { latitude: 53.5755540000001, longitude: 0.123333000000059 }, Coordinate { latitude: 53.587494, longitude: 0.135832999999991 }, Coordinate { latitude: 53.5913850000001, longitude: 0.137778000000139 }, Coordinate { latitude: 53.5958330000001, longitude: 0.138889000000063 }, Coordinate { latitude: 53.599716, longitude: 0.138333000000046 }, Coordinate { latitude: 53.6083300000001, longitude: 0.130555999999956 }, Coordinate { latitude: 53.6191640000001, longitude: 0.109167000000014 }, Coordinate { latitude: 53.6266630000001, longitude: 0.0891670000000886 }, Coordinate { latitude: 53.6333310000001, longitude: 0.0675000000000523 }, Coordinate { latitude: 53.6391600000001, longitude: 0.0441670000000158 }, Coordinate { latitude: 53.639999, longitude: 0.0297219999999356 }, Coordinate { latitude: 53.6394420000001, longitude: 0.0169439999999668 }, Coordinate { latitude: 53.638611, longitude: 0.0111109999999712 }, Coordinate { latitude: 53.6355360000001, longitude: 0.0 }, Coordinate { latitude: 53.625549, longitude: -0.0347219999999879 }, Coordinate { latitude: 53.623055, longitude: -0.0516669999999522 }, Coordinate { latitude: 53.6224980000001, longitude: -0.0713890000000106 }, Coordinate { latitude: 53.6233290000001, longitude: -0.0788890000000038 }, Coordinate { latitude: 53.6244430000001, longitude: -0.08555599999994 }, Coordinate { latitude: 53.63166, longitude: -0.105833000000018 }, Coordinate { latitude: 53.6413880000001, longitude: -0.129721999999958 }, Coordinate { latitude: 53.6480480000001, longitude: -0.141944000000024 }, Coordinate { latitude: 53.675278, longitude: -0.171667000000014 }, Coordinate { latitude: 53.721664, longitude: -0.231388999999979 }, Coordinate { latitude: 53.7297209999999, longitude: -0.249443999999926 }, Coordinate { latitude: 53.7355499999999, longitude: -0.27249999999998 }, Coordinate { latitude: 53.7366640000001, longitude: -0.293888999999922 }, Coordinate { latitude: 53.730553, longitude: -0.357277999999951 }, Coordinate { latitude: 53.726551, longitude: -0.380943999999943 }, Coordinate { latitude: 53.7175520000001, longitude: -0.422611000000018 }, Coordinate { latitude: 53.706108, longitude: -0.549166999999954 }, Coordinate { latitude: 53.7091600000001, longitude: -0.560833000000002 }, Coordinate { latitude: 53.7136080000001, longitude: -0.569166999999993 }, Coordinate { latitude: 53.721664, longitude: -0.577777999999967 }, Coordinate { latitude: 53.726662, longitude: -0.58611099999996 }, Coordinate { latitude: 53.7297209999999, longitude: -0.605833000000018 }, Coordinate { latitude: 53.7299960000001, longitude: -0.619721999999967 }, Coordinate { latitude: 53.729164, longitude: -0.632222000000013 }, Coordinate { latitude: 53.725273, longitude: -0.654443999999955 }, Coordinate { latitude: 53.7191620000001, longitude: -0.674167000000011 }, Coordinate { latitude: 53.7158280000001, longitude: -0.683333000000005 }, Coordinate { latitude: 53.699715, longitude: -0.71888899999999 }, Coordinate { latitude: 53.6930540000001, longitude: -0.714166999999918 }, Coordinate { latitude: 53.6861040000001, longitude: -0.693055999999956 }, Coordinate { latitude: 53.685272, longitude: -0.519722000000002 }, Coordinate { latitude: 53.68644, longitude: -0.504888999999935 }, Coordinate { latitude: 53.696106, longitude: -0.457889000000023 }, Coordinate { latitude: 53.7079429999999, longitude: -0.390221999999937 }, Coordinate { latitude: 53.7136080000001, longitude: -0.305555999999967 }, Coordinate { latitude: 53.712776, longitude: -0.297777999999994 }, Coordinate { latitude: 53.708611, longitude: -0.287778000000003 }, Coordinate { latitude: 53.690826, longitude: -0.264443999999969 }, Coordinate { latitude: 53.6680530000001, longitude: -0.241567999999916 }, Coordinate { latitude: 53.653328, longitude: -0.230555999999979 }, Coordinate { latitude: 53.6444400000001, longitude: -0.222778000000005 }, Coordinate { latitude: 53.630829, longitude: -0.207221999999945 }, Coordinate { latitude: 53.58194, longitude: -0.11722199999997 }, Coordinate { latitude: 53.5730510000001, longitude: -0.100833000000023 }, Coordinate { latitude: 53.50972, longitude: 0.0269440000001282 }, Coordinate { latitude: 53.4863820000001, longitude: 0.0852780000000166 }, Coordinate { latitude: 53.4747160000001, longitude: 0.122777999999983 }, Coordinate { latitude: 53.474159, longitude: 0.128610999999978 }, Coordinate { latitude: 53.4758300000001, longitude: 0.13999999999993 }, Coordinate { latitude: 53.4747160000001, longitude: 0.146944000000019 }, Coordinate { latitude: 53.4599989999999, longitude: 0.168611000000055 }, Coordinate { latitude: 53.416939, longitude: 0.216944000000069 }, Coordinate { latitude: 53.399437, longitude: 0.235556000000088 }, Coordinate { latitude: 53.3805540000001, longitude: 0.247499999999945 }, Coordinate { latitude: 53.367775, longitude: 0.255000000000052 }, Coordinate { latitude: 53.3463820000001, longitude: 0.269999999999982 }, Coordinate { latitude: 53.236382, longitude: 0.338889000000108 }, Coordinate { latitude: 53.233055, longitude: 0.340278000000126 }, Coordinate { latitude: 53.1872180000001, longitude: 0.353889000000095 }, Coordinate { latitude: 53.1763840000001, longitude: 0.356388999999979 }, Coordinate { latitude: 53.160828, longitude: 0.357777999999996 }, Coordinate { latitude: 53.1486050000001, longitude: 0.356667000000073 }, Coordinate { latitude: 53.1394420000001, longitude: 0.354166999999961 }, Coordinate { latitude: 53.095833, longitude: 0.341666999999916 }, Coordinate { latitude: 53.0888820000001, longitude: 0.33666699999992 }, Coordinate { latitude: 53.0838850000001, longitude: 0.329167000000041 }, Coordinate { latitude: 53.082497, longitude: 0.324167000000045 }, Coordinate { latitude: 53.06694, longitude: 0.276667000000089 }, Coordinate { latitude: 53.028053, longitude: 0.203889000000061 }, Coordinate { latitude: 53.0091630000001, longitude: 0.173332999999957 }, Coordinate { latitude: 52.917221, longitude: 0.032222000000047 }, Coordinate { latitude: 52.8828350000001, longitude: 0.00184000000012929 }, Coordinate { latitude: 52.8795469999999, longitude: 3.70000001339577E-05 }, Coordinate { latitude: 52.8775630000001, longitude: 0.00656200000003082 }, Coordinate { latitude: 52.880829, longitude: 0.0280559999999355 }, Coordinate { latitude: 52.8891600000001, longitude: 0.0577779999999848 }, Coordinate { latitude: 52.8908309999999, longitude: 0.0688890000000129 }, Coordinate { latitude: 52.891106, longitude: 0.0752780000000257 }, Coordinate { latitude: 52.8897170000001, longitude: 0.0863890000000538 }, Coordinate { latitude: 52.877495, longitude: 0.122222000000022 }, Coordinate { latitude: 52.868607, longitude: 0.147500000000036 }, Coordinate { latitude: 52.8647159999999, longitude: 0.157222000000104 }, Coordinate { latitude: 52.860275, longitude: 0.165278000000001 }, Coordinate { latitude: 52.854996, longitude: 0.171666999999957 }, Coordinate { latitude: 52.8491590000001, longitude: 0.176110999999935 }, Coordinate { latitude: 52.8377760000001, longitude: 0.186943999999926 }, Coordinate { latitude: 52.8069380000001, longitude: 0.217778000000123 }, Coordinate { latitude: 52.7980500000001, longitude: 0.233888999999976 }, Coordinate { latitude: 52.796104, longitude: 0.238611000000105 }, Coordinate { latitude: 52.795273, longitude: 0.243888999999967 }, Coordinate { latitude: 52.780273, longitude: 0.363333000000068 }, Coordinate { latitude: 52.7813870000001, longitude: 0.378889000000015 }, Coordinate { latitude: 52.8224950000001, longitude: 0.427500000000066 }, Coordinate { latitude: 52.8255540000001, longitude: 0.430555999999967 }, Coordinate { latitude: 52.8288880000001, longitude: 0.433056000000079 }, Coordinate { latitude: 52.8369370000001, longitude: 0.43694400000004 }, Coordinate { latitude: 52.845551, longitude: 0.438333000000057 }, Coordinate { latitude: 52.863609, longitude: 0.443333000000052 }, Coordinate { latitude: 52.8677750000001, longitude: 0.44527800000003 }, Coordinate { latitude: 52.9311069999999, longitude: 0.488611000000049 }, Coordinate { latitude: 52.9374920000001, longitude: 0.494167000000004 }, Coordinate { latitude: 52.9647220000001, longitude: 0.540833000000077 }, Coordinate { latitude: 52.9661100000001, longitude: 0.545833000000073 }, Coordinate { latitude: 52.966942, longitude: 0.552222000000086 }, Coordinate { latitude: 52.976105, longitude: 0.667221999999981 }, Coordinate { latitude: 52.9677730000001, longitude: 0.877778000000035 }, Coordinate { latitude: 52.967216, longitude: 0.882777999999973 }, Coordinate { latitude: 52.9652710000001, longitude: 0.889166999999986 }, Coordinate { latitude: 52.9577710000001, longitude: 0.89861100000013 }, Coordinate { latitude: 52.953049, longitude: 0.907500000000027 }, Coordinate { latitude: 52.9522170000001, longitude: 0.911667000000023 }, Coordinate { latitude: 52.950829, longitude: 0.942222000000015 }, Coordinate { latitude: 52.9499970000001, longitude: 0.969722000000047 }, Coordinate { latitude: 52.9511110000001, longitude: 0.994722000000024 }, Coordinate { latitude: 52.952774, longitude: 1.00583300000005 }, Coordinate { latitude: 52.9388890000001, longitude: 1.18388900000008 }, Coordinate { latitude: 52.9274980000001, longitude: 1.28222199999993 }, Coordinate { latitude: 52.921661, longitude: 1.30583300000006 }, Coordinate { latitude: 52.9097210000001, longitude: 1.35250000000008 }, Coordinate { latitude: 52.902496, longitude: 1.3727780000001 }, Coordinate { latitude: 52.893608, longitude: 1.39333299999998 }, Coordinate { latitude: 52.8747180000001, longitude: 1.43222200000014 }, Coordinate { latitude: 52.8544390000001, longitude: 1.46861100000007 }, Coordinate { latitude: 52.837494, longitude: 1.50361099999998 }, Coordinate { latitude: 52.8313830000001, longitude: 1.51722200000012 }, Coordinate { latitude: 52.825272, longitude: 1.53083300000009 }, Coordinate { latitude: 52.7711110000001, longitude: 1.64527800000008 }, Coordinate { latitude: 52.76416, longitude: 1.65694400000007 }, Coordinate { latitude: 52.7480550000001, longitude: 1.67527799999999 }, Coordinate { latitude: 52.7366640000001, longitude: 1.68638900000008 }, Coordinate { latitude: 52.7158280000001, longitude: 1.70249999999993 }, Coordinate { latitude: 52.706108, longitude: 1.70722200000006 }, Coordinate { latitude: 52.6766660000001, longitude: 1.72111100000006 }, Coordinate { latitude: 52.62722, longitude: 1.74388900000002 }, Coordinate { latitude: 52.620277, longitude: 1.74638900000014 }, Coordinate { latitude: 52.616661, longitude: 1.74666600000012 }, Coordinate { latitude: 52.529106, longitude: 1.74898200000007 }, Coordinate { latitude: 52.455826, longitude: 1.74944399999993 }, Coordinate { latitude: 52.411385, longitude: 1.73027800000006 }, Coordinate { latitude: 52.3930510000001, longitude: 1.73305499999998 }, Coordinate { latitude: 52.3816600000001, longitude: 1.72666599999997 }, Coordinate { latitude: 52.3263020000001, longitude: 1.68575100000004 }, Coordinate { latitude: 52.1952740000001, longitude: 1.63000000000005 }, Coordinate { latitude: 52.182495, longitude: 1.62777800000003 }, Coordinate { latitude: 52.1736070000001, longitude: 1.62500000000006 }, Coordinate { latitude: 52.0855480000001, longitude: 1.58861100000013 }, Coordinate { latitude: 52.0822220000001, longitude: 1.58611100000007 }, Coordinate { latitude: 52.0763850000001, longitude: 1.57972200000006 }, Coordinate { latitude: 51.969994, longitude: 1.39027800000014 }, Coordinate { latitude: 51.9291610000001, longitude: 1.33388900000011 }, Coordinate { latitude: 51.928329, longitude: 1.32861100000002 }, Coordinate { latitude: 51.943604, longitude: 1.31777800000003 }, Coordinate { latitude: 51.9827730000001, longitude: 1.28083299999997 }, Coordinate { latitude: 51.988327, longitude: 1.27416699999998 }, Coordinate { latitude: 51.9924930000001, longitude: 1.26472200000006 }, Coordinate { latitude: 52.025833, longitude: 1.17027799999994 }, Coordinate { latitude: 52.0255510000001, longitude: 1.16472199999998 }, Coordinate { latitude: 52.0233310000001, longitude: 1.16027799999995 }, Coordinate { latitude: 52.0197220000001, longitude: 1.15861100000006 }, Coordinate { latitude: 51.950829, longitude: 1.20833300000004 }, Coordinate { latitude: 51.8811040000001, longitude: 1.27805499999999 }, Coordinate { latitude: 51.880829, longitude: 1.28388900000004 }, Coordinate { latitude: 51.87944, longitude: 1.28888900000004 }, Coordinate { latitude: 51.877495, longitude: 1.29361100000011 }, Coordinate { latitude: 51.8697200000001, longitude: 1.295278 }, Coordinate { latitude: 51.8549960000001, longitude: 1.28638899999993 }, Coordinate { latitude: 51.849716, longitude: 1.28027800000007 }, Coordinate { latitude: 51.8391650000001, longitude: 1.26611100000008 }, Coordinate { latitude: 51.808884, longitude: 1.22361100000012 }, Coordinate { latitude: 51.7999950000001, longitude: 1.20833300000004 }, Coordinate { latitude: 51.7961040000001, longitude: 1.19972200000007 }, Coordinate { latitude: 51.789719, longitude: 1.18138900000002 }, Coordinate { latitude: 51.7769390000001, longitude: 1.13222200000013 }, Coordinate { latitude: 51.773331, longitude: 1.11166600000001 }, Coordinate { latitude: 51.7705540000001, longitude: 1.08833299999998 }, Coordinate { latitude: 51.7705540000001, longitude: 1.04999999999995 }, Coordinate { latitude: 51.7727740000001, longitude: 1.03722199999999 }, Coordinate { latitude: 51.775551, longitude: 1.03416700000002 }, Coordinate { latitude: 51.810829, longitude: 0.997500000000002 }, Coordinate { latitude: 51.826111, longitude: 0.986667000000011 }, Coordinate { latitude: 51.82444, longitude: 0.978889000000038 }, Coordinate { latitude: 51.807777, longitude: 0.936666999999943 }, Coordinate { latitude: 51.803886, longitude: 0.92805599999997 }, Coordinate { latitude: 51.7736050000001, longitude: 0.862111000000084 }, Coordinate { latitude: 51.726662, longitude: 0.724167000000023 }, Coordinate { latitude: 51.7222210000001, longitude: 0.704167000000041 }, Coordinate { latitude: 51.719444, longitude: 0.699722000000008 }, Coordinate { latitude: 51.71611, longitude: 0.700277999999969 }, Coordinate { latitude: 51.6913830000001, longitude: 0.758610999999917 }, Coordinate { latitude: 51.6919020000001, longitude: 0.764184000000057 }, Coordinate { latitude: 51.711662, longitude: 0.863055000000031 }, Coordinate { latitude: 51.7147220000001, longitude: 0.872778000000039 }, Coordinate { latitude: 51.7191619999999, longitude: 0.879999999999995 }, Coordinate { latitude: 51.7332730000001, longitude: 0.89944400000013 }, Coordinate { latitude: 51.73444, longitude: 0.901611000000003 }, Coordinate { latitude: 51.735443, longitude: 0.904611000000102 }, Coordinate { latitude: 51.740555, longitude: 0.918888999999979 }, Coordinate { latitude: 51.740273, longitude: 0.926110999999992 }, Coordinate { latitude: 51.738609, longitude: 0.931666999999948 }, Coordinate { latitude: 51.734444, longitude: 0.939722000000131 }, Coordinate { latitude: 51.7255550000001, longitude: 0.946943999999917 }, Coordinate { latitude: 51.614166, longitude: 0.954999999999984 }, Coordinate { latitude: 51.609993, longitude: 0.953889000000117 }, Coordinate { latitude: 51.606384, longitude: 0.950555000000122 }, Coordinate { latitude: 51.581383, longitude: 0.910000000000139 }, Coordinate { latitude: 51.5611040000001, longitude: 0.875278000000094 }, Coordinate { latitude: 51.535553, longitude: 0.820832999999993 }, Coordinate { latitude: 51.529999, longitude: 0.808056000000079 }, Coordinate { latitude: 51.524162, longitude: 0.78944400000006 }, Coordinate { latitude: 51.521942, longitude: 0.779167000000086 }, Coordinate { latitude: 51.5213850000001, longitude: 0.766944000000024 }, Coordinate { latitude: 51.532219, longitude: 0.680555000000027 }, Coordinate { latitude: 51.536942, longitude: 0.654999999999973 }, Coordinate { latitude: 51.536659, longitude: 0.648889000000111 }, Coordinate { latitude: 51.5030520000001, longitude: 0.465000000000089 }, Coordinate { latitude: 51.498055, longitude: 0.451667000000043 }, Coordinate { latitude: 51.4505540000001, longitude: 0.382778000000087 }, Coordinate { latitude: 51.4484560000001, longitude: 0.386852999999917 }, Coordinate { latitude: 51.446938, longitude: 0.393055000000061 }, Coordinate { latitude: 51.446938, longitude: 0.412222000000043 }, Coordinate { latitude: 51.4516600000001, longitude: 0.44388900000007 }, Coordinate { latitude: 51.455276, longitude: 0.452500000000043 }, Coordinate { latitude: 51.457771, longitude: 0.456111000000021 }, Coordinate { latitude: 51.4674990000001, longitude: 0.463888999999995 }, Coordinate { latitude: 51.474998, longitude: 0.46805599999999 }, Coordinate { latitude: 51.47805, longitude: 0.471111000000008 }, Coordinate { latitude: 51.4822160000001, longitude: 0.478888999999981 }, Coordinate { latitude: 51.484444, longitude: 0.489167000000009 }, Coordinate { latitude: 51.4880519999999, longitude: 0.536111000000005 }, Coordinate { latitude: 51.4880519999999, longitude: 0.548888999999974 }, Coordinate { latitude: 51.4880519999999, longitude: 0.588333000000091 }, Coordinate { latitude: 51.487495, longitude: 0.595555999999931 }, Coordinate { latitude: 51.470833, longitude: 0.697499999999991 }, Coordinate { latitude: 51.4674990000001, longitude: 0.707778000000076 }, Coordinate { latitude: 51.463333, longitude: 0.716111000000126 }, Coordinate { latitude: 51.461105, longitude: 0.720000000000027 }, Coordinate { latitude: 51.455276, longitude: 0.725278000000117 }, Coordinate { latitude: 51.451942, longitude: 0.726667000000077 }, Coordinate { latitude: 51.448326, longitude: 0.726944000000117 }, Coordinate { latitude: 51.4441600000001, longitude: 0.725278000000117 }, Coordinate { latitude: 51.4408260000001, longitude: 0.722778000000005 }, Coordinate { latitude: 51.4383320000001, longitude: 0.719167000000027 }, Coordinate { latitude: 51.436104, longitude: 0.708888999999942 }, Coordinate { latitude: 51.4352720000001, longitude: 0.690833000000112 }, Coordinate { latitude: 51.435555, longitude: 0.684167000000116 }, Coordinate { latitude: 51.439163, longitude: 0.665832999999964 }, Coordinate { latitude: 51.441109, longitude: 0.644722000000115 }, Coordinate { latitude: 51.43972, longitude: 0.640000000000043 }, Coordinate { latitude: 51.41111, longitude: 0.558056000000136 }, Coordinate { latitude: 51.4080510000001, longitude: 0.556389000000024 }, Coordinate { latitude: 51.4049989999999, longitude: 0.558611000000042 }, Coordinate { latitude: 51.3997190000001, longitude: 0.564722000000131 }, Coordinate { latitude: 51.389999, longitude: 0.5783330000001 }, Coordinate { latitude: 51.3877720000001, longitude: 0.582222000000002 }, Coordinate { latitude: 51.3863830000001, longitude: 0.587777999999958 }, Coordinate { latitude: 51.3830490000001, longitude: 0.619721999999967 }, Coordinate { latitude: 51.3774950000001, longitude: 0.704167000000041 }, Coordinate { latitude: 51.3408280000001, longitude: 0.904999999999973 }, Coordinate { latitude: 51.3405530000001, longitude: 0.911111000000005 }, Coordinate { latitude: 51.3455510000001, longitude: 0.981388999999922 }, Coordinate { latitude: 51.3477710000001, longitude: 0.999167000000057 }, Coordinate { latitude: 51.3519440000001, longitude: 1.01222200000007 }, Coordinate { latitude: 51.3619380000001, longitude: 1.03333300000008 }, Coordinate { latitude: 51.367218, longitude: 1.05277799999993 }, Coordinate { latitude: 51.368889, longitude: 1.06277799999992 }, Coordinate { latitude: 51.3694379999999, longitude: 1.06972200000001 }, Coordinate { latitude: 51.3786090000001, longitude: 1.19194400000009 }, Coordinate { latitude: 51.3877720000001, longitude: 1.38555600000007 }, Coordinate { latitude: 51.331108, longitude: 1.42750000000007 }, Coordinate { latitude: 51.2011110000001, longitude: 1.41111100000012 }, Coordinate { latitude: 51.188332, longitude: 1.4088890000001 }, Coordinate { latitude: 51.1794430000001, longitude: 1.40638900000005 }, Coordinate { latitude: 51.163887, longitude: 1.39833299999998 }, Coordinate { latitude: 51.15416, longitude: 1.39027800000014 }, Coordinate { latitude: 51.1358260000001, longitude: 1.36888900000002 }, Coordinate { latitude: 51.128609, longitude: 1.35805499999998 }, Coordinate { latitude: 51.1266630000001, longitude: 1.35361099999994 }, Coordinate { latitude: 51.101662, longitude: 1.2625000000001 }, Coordinate { latitude: 51.10083, longitude: 1.231944 }, Coordinate { latitude: 51.099716, longitude: 1.2205560000001 }, Coordinate { latitude: 51.073608, longitude: 1.10027800000012 }, Coordinate { latitude: 51.0686040000001, longitude: 1.08694399999996 }, Coordinate { latitude: 51.049438, longitude: 1.04555500000009 }, Coordinate { latitude: 51.040833, longitude: 1.03000000000003 }, Coordinate { latitude: 51.0216600000001, longitude: 1.00111099999998 }, Coordinate { latitude: 51.0163880000001, longitude: 0.994444000000101 }, Coordinate { latitude: 51.007217, longitude: 0.986111000000051 }, Coordinate { latitude: 50.9966660000001, longitude: 0.978889000000038 }, Coordinate { latitude: 50.9852750000001, longitude: 0.972777999999948 }, Coordinate { latitude: 50.9769440000001, longitude: 0.969722000000047 }, Coordinate { latitude: 50.96833, longitude: 0.968054999999993 }, Coordinate { latitude: 50.945274, longitude: 0.970000000000141 }, Coordinate { latitude: 50.931938, longitude: 0.975000000000136 }, Coordinate { latitude: 50.9255520000001, longitude: 0.856666999999959 }, Coordinate { latitude: 50.934441, longitude: 0.814166999999998 }, Coordinate { latitude: 50.9361040000001, longitude: 0.793333000000132 }, Coordinate { latitude: 50.9355550000001, longitude: 0.781389000000047 }, Coordinate { latitude: 50.904999, longitude: 0.716389000000049 }, Coordinate { latitude: 50.897774, longitude: 0.705833000000041 }, Coordinate { latitude: 50.8791660000001, longitude: 0.682500000000005 }, Coordinate { latitude: 50.8744430000001, longitude: 0.675278000000048 }, Coordinate { latitude: 50.8694380000001, longitude: 0.662221999999986 }, Coordinate { latitude: 50.847771, longitude: 0.567222000000015 }, Coordinate { latitude: 50.8380510000001, longitude: 0.498610999999983 }, Coordinate { latitude: 50.8338850000001, longitude: 0.452778000000137 }, Coordinate { latitude: 50.831108, longitude: 0.430833000000007 }, Coordinate { latitude: 50.82444, longitude: 0.400556000000051 }, Coordinate { latitude: 50.816383, longitude: 0.371944000000042 }, Coordinate { latitude: 50.808609, longitude: 0.349444000000005 }, Coordinate { latitude: 50.7805480000001, longitude: 0.307222000000081 }, Coordinate { latitude: 50.773331, longitude: 0.29638899999992 }, Coordinate { latitude: 50.764999, longitude: 0.286944000000062 }, Coordinate { latitude: 50.7516630000001, longitude: 0.276944000000071 }, Coordinate { latitude: 50.745827, longitude: 0.271111000000076 }, Coordinate { latitude: 50.7413860000001, longitude: 0.263611000000026 }, Coordinate { latitude: 50.738609, longitude: 0.253889000000129 }, Coordinate { latitude: 50.7380520000001, longitude: 0.242222000000083 }, Coordinate { latitude: 50.7394410000001, longitude: 0.227778000000114 }, Coordinate { latitude: 50.7416610000001, longitude: 0.215278000000069 }, Coordinate { latitude: 50.759438, longitude: 0.123333000000059 }, Coordinate { latitude: 50.7677760000001, longitude: 0.0983330000001388 }, Coordinate { latitude: 50.78083, longitude: 0.0569440000000441 }, Coordinate { latitude: 50.8102720000001, longitude: -0.0944439999999531 }, Coordinate { latitude: 50.8183290000001, longitude: -0.138056000000006 }, Coordinate { latitude: 50.8213880000001, longitude: -0.156943999999953 }, Coordinate { latitude: 50.825829, longitude: -0.190832999999998 }, Coordinate { latitude: 50.82666, longitude: -0.206111000000021 }, Coordinate { latitude: 50.826385, longitude: -0.254999999999995 }, Coordinate { latitude: 50.7952730000001, longitude: -0.577221999999949 }, Coordinate { latitude: 50.7872160000001, longitude: -0.637499999999989 }, Coordinate { latitude: 50.781105, longitude: -0.675277999999992 }, Coordinate { latitude: 50.7738880000001, longitude: -0.711388999999997 }, Coordinate { latitude: 50.7658310000001, longitude: -0.746110999999928 }, Coordinate { latitude: 50.752777, longitude: -0.768055999999945 }, Coordinate { latitude: 50.7466659999999, longitude: -0.766666999999984 }, Coordinate { latitude: 50.7430500000001, longitude: -0.766666999999984 }, Coordinate { latitude: 50.7349930000001, longitude: -0.769166999999982 }, Coordinate { latitude: 50.7291639999999, longitude: -0.776388999999938 }, Coordinate { latitude: 50.727493, longitude: -0.780555999999933 }, Coordinate { latitude: 50.7261050000001, longitude: -0.785278000000005 }, Coordinate { latitude: 50.725273, longitude: -0.796388999999976 }, Coordinate { latitude: 50.7272190000001, longitude: -0.802499999999952 }, Coordinate { latitude: 50.7680510000001, longitude: -0.903332999999918 }, Coordinate { latitude: 50.772217, longitude: -0.910278000000005 }, Coordinate { latitude: 50.7761080000001, longitude: -0.910832999999968 }, Coordinate { latitude: 50.7794420000001, longitude: -0.908611000000008 }, Coordinate { latitude: 50.7894440000001, longitude: -0.894444000000021 }, Coordinate { latitude: 50.791382, longitude: -0.890555999999947 }, Coordinate { latitude: 50.7952730000001, longitude: -0.869167000000004 }, Coordinate { latitude: 50.7977750000001, longitude: -0.865833000000009 }, Coordinate { latitude: 50.800827, longitude: -0.863610999999935 }, Coordinate { latitude: 50.8047179999999, longitude: -0.864721999999915 }, Coordinate { latitude: 50.808884, longitude: -0.871944999999982 }, Coordinate { latitude: 50.839439, longitude: -0.926943999999935 }, Coordinate { latitude: 50.839874, longitude: -0.929896999999926 }, Coordinate { latitude: 50.840828, longitude: -0.939166999999998 }, Coordinate { latitude: 50.8458330000001, longitude: -1.09444500000001 }, Coordinate { latitude: 50.844162, longitude: -1.15472199999994 }, Coordinate { latitude: 50.842773, longitude: -1.15944499999995 }, Coordinate { latitude: 50.839722, longitude: -1.16222199999993 }, Coordinate { latitude: 50.8366619999999, longitude: -1.15916700000002 }, Coordinate { latitude: 50.831108, longitude: -1.14666699999998 }, Coordinate { latitude: 50.811943, longitude: -1.11805600000002 }, Coordinate { latitude: 50.808884, longitude: -1.11638900000003 }, Coordinate { latitude: 50.805275, longitude: -1.11583399999995 }, Coordinate { latitude: 50.801666, longitude: -1.11749999999995 }, Coordinate { latitude: 50.7872160000001, longitude: -1.12722200000002 }, Coordinate { latitude: 50.784164, longitude: -1.12944499999992 }, Coordinate { latitude: 50.7816620000001, longitude: -1.13277799999992 }, Coordinate { latitude: 50.7794420000001, longitude: -1.13694499999997 }, Coordinate { latitude: 50.7783280000001, longitude: -1.14166699999998 }, Coordinate { latitude: 50.777496, longitude: -1.14694499999996 }, Coordinate { latitude: 50.791382, longitude: -1.331389 }, Coordinate { latitude: 50.7708280000001, longitude: -1.40805599999999 }, Coordinate { latitude: 50.724159, longitude: -1.59277800000001 }, Coordinate { latitude: 50.729721, longitude: -1.61416699999995 }, Coordinate { latitude: 50.737495, longitude: -1.663611 }, Coordinate { latitude: 50.7382580000001, longitude: -1.67236100000002 }, Coordinate { latitude: 50.738884, longitude: -1.68444499999998 }, Coordinate { latitude: 50.7369380000001, longitude: -1.70138900000001 }, Coordinate { latitude: 50.7230530000001, longitude: -1.81638900000002 }, Coordinate { latitude: 50.7127760000001, longitude: -1.934167 }, Coordinate { latitude: 50.714996, longitude: -2.00944500000003 }, Coordinate { latitude: 50.7177730000001, longitude: -2.020556 }, Coordinate { latitude: 50.7222210000001, longitude: -2.02749999999998 }, Coordinate { latitude: 50.7255550000001, longitude: -2.02972299999993 }, Coordinate { latitude: 50.7324980000001, longitude: -2.03194499999995 }, Coordinate { latitude: 50.734161, longitude: -2.03611099999995 }, Coordinate { latitude: 50.7338870000001, longitude: -2.041945 }, Coordinate { latitude: 50.7155529999999, longitude: -2.06555599999996 }, Coordinate { latitude: 50.7130510000001, longitude: -2.06805599999996 }, Coordinate { latitude: 50.7005540000001, longitude: -2.07944500000002 }, Coordinate { latitude: 50.6974950000001, longitude: -2.081389 }, Coordinate { latitude: 50.69416, longitude: -2.079722 }, Coordinate { latitude: 50.670273, longitude: -1.97472199999999 }, Coordinate { latitude: 50.663609, longitude: -1.96322199999997 }, Coordinate { latitude: 50.6666070000001, longitude: -1.95905599999992 }, Coordinate { latitude: 50.667774, longitude: -1.95622199999997 }, Coordinate { latitude: 50.6671099999999, longitude: -1.95288899999997 }, Coordinate { latitude: 50.66544, longitude: -1.95138899999995 }, Coordinate { latitude: 50.6634450000001, longitude: -1.95055599999995 }, Coordinate { latitude: 50.639442, longitude: -1.93555600000002 }, Coordinate { latitude: 50.5986100000001, longitude: -1.95833299999993 }, Coordinate { latitude: 50.596664, longitude: -1.96249999999992 }, Coordinate { latitude: 50.595833, longitude: -1.96833299999992 }, Coordinate { latitude: 50.585831, longitude: -2.05138899999992 }, Coordinate { latitude: 50.585548, longitude: -2.0575 }, Coordinate { latitude: 50.607216, longitude: -2.12194499999993 }, Coordinate { latitude: 50.613327, longitude: -2.13388900000001 }, Coordinate { latitude: 50.6169430000001, longitude: -2.14472199999994 }, Coordinate { latitude: 50.6261060000001, longitude: -2.19722200000001 }, Coordinate { latitude: 50.6416629999999, longitude: -2.38805600000001 }, Coordinate { latitude: 50.6416629999999, longitude: -2.393889 }, Coordinate { latitude: 50.634995, longitude: -2.43111099999999 }, Coordinate { latitude: 50.6263890000001, longitude: -2.44666699999999 }, Coordinate { latitude: 50.598328, longitude: -2.46444500000001 }, Coordinate { latitude: 50.589996, longitude: -2.46749999999992 }, Coordinate { latitude: 50.5838850000001, longitude: -2.46583399999992 }, Coordinate { latitude: 50.5749970000001, longitude: -2.45861100000002 }, Coordinate { latitude: 50.5599980000001, longitude: -2.42472299999991 }, Coordinate { latitude: 50.54179, longitude: -2.43445100000002 }, Coordinate { latitude: 50.5489010000001, longitude: -2.45523099999997 }, Coordinate { latitude: 50.561749, longitude: -2.45823899999999 }, Coordinate { latitude: 50.5956540000001, longitude: -2.49460499999992 }, Coordinate { latitude: 50.632217, longitude: -2.56305599999996 }, Coordinate { latitude: 50.6733320000001, longitude: -2.661945 }, Coordinate { latitude: 50.6869430000001, longitude: -2.70055600000001 }, Coordinate { latitude: 50.693329, longitude: -2.72111099999995 }, Coordinate { latitude: 50.7086110000001, longitude: -2.771389 }, Coordinate { latitude: 50.7202760000001, longitude: -2.82305599999995 }, Coordinate { latitude: 50.7283330000001, longitude: -2.86388899999997 }, Coordinate { latitude: 50.73111, longitude: -2.88277799999992 }, Coordinate { latitude: 50.73333, longitude: -2.90694499999995 }, Coordinate { latitude: 50.731941, longitude: -2.92472299999991 }, Coordinate { latitude: 50.7305530000001, longitude: -2.93027799999999 }, Coordinate { latitude: 50.723328, longitude: -2.94444499999997 }, Coordinate { latitude: 50.7127760000001, longitude: -2.95944500000002 }, Coordinate { latitude: 50.7063830000001, longitude: -2.97805599999998 }, Coordinate { latitude: 50.692215, longitude: -3.09444499999995 }, Coordinate { latitude: 50.6886060000001, longitude: -3.17055599999998 }, Coordinate { latitude: 50.688049, longitude: -3.17638899999997 }, Coordinate { latitude: 50.674438, longitude: -3.24416699999995 }, Coordinate { latitude: 50.6719440000001, longitude: -3.25416699999994 }, Coordinate { latitude: 50.6161040000001, longitude: -3.41138899999993 }, Coordinate { latitude: 50.6049960000001, longitude: -3.43722199999996 }, Coordinate { latitude: 50.5905530000001, longitude: -3.45861100000002 }, Coordinate { latitude: 50.5852740000001, longitude: -3.46499999999998 }, Coordinate { latitude: 50.5463870000001, longitude: -3.494167 }, Coordinate { latitude: 50.535828, longitude: -3.50027799999998 }, Coordinate { latitude: 50.438332, longitude: -3.55138899999997 }, Coordinate { latitude: 50.425552, longitude: -3.55333399999995 }, Coordinate { latitude: 50.2311100000001, longitude: -3.65194500000001 }, Coordinate { latitude: 50.2202760000001, longitude: -3.67499999999995 }, Coordinate { latitude: 50.209717, longitude: -3.70666699999998 }, Coordinate { latitude: 50.2066650000001, longitude: -3.71666699999992 }, Coordinate { latitude: 50.206383, longitude: -3.72888899999998 }, Coordinate { latitude: 50.2122190000001, longitude: -3.78944399999995 }, Coordinate { latitude: 50.214165, longitude: -3.80305600000003 }, Coordinate { latitude: 50.217216, longitude: -3.813334 }, Coordinate { latitude: 50.227219, longitude: -3.83333299999993 }, Coordinate { latitude: 50.2322159999999, longitude: -3.83972299999999 }, Coordinate { latitude: 50.238052, longitude: -3.84499999999997 }, Coordinate { latitude: 50.251663, longitude: -3.851944 }, Coordinate { latitude: 50.2799990000001, longitude: -3.87638900000002 }, Coordinate { latitude: 50.282776, longitude: -3.87888900000002 }, Coordinate { latitude: 50.312492, longitude: -3.94083399999994 }, Coordinate { latitude: 50.3144380000001, longitude: -3.94694500000003 }, Coordinate { latitude: 50.3155520000001, longitude: -3.95194500000002 }, Coordinate { latitude: 50.3155520000001, longitude: -3.95861100000002 }, Coordinate { latitude: 50.313889, longitude: -3.97583299999997 }, Coordinate { latitude: 50.311386, longitude: -3.98555599999992 }, Coordinate { latitude: 50.3061070000001, longitude: -4.005 }, Coordinate { latitude: 50.3011090000001, longitude: -4.01166699999993 }, Coordinate { latitude: 50.2983320000001, longitude: -4.01416699999993 }, Coordinate { latitude: 50.2944410000001, longitude: -4.02277900000001 }, Coordinate { latitude: 50.293053, longitude: -4.02805599999999 }, Coordinate { latitude: 50.29277, longitude: -4.03361100000001 }, Coordinate { latitude: 50.2958300000001, longitude: -4.05277799999993 }, Coordinate { latitude: 50.2999950000001, longitude: -4.06138900000002 }, Coordinate { latitude: 50.3302760000001, longitude: -4.11138899999997 }, Coordinate { latitude: 50.3702769999999, longitude: -4.16555599999998 }, Coordinate { latitude: 50.377777, longitude: -4.17500000000001 }, Coordinate { latitude: 50.363884, longitude: -4.38 }, Coordinate { latitude: 50.3533330000001, longitude: -4.42555599999997 }, Coordinate { latitude: 50.349442, longitude: -4.43388900000002 }, Coordinate { latitude: 50.344437, longitude: -4.44098400000001 }, Coordinate { latitude: 50.3369370000001, longitude: -4.45083399999999 }, Coordinate { latitude: 50.33416, longitude: -4.45333399999998 }, Coordinate { latitude: 50.3291630000001, longitude: -4.46638999999993 }, Coordinate { latitude: 50.3258290000001, longitude: -4.48277899999999 }, Coordinate { latitude: 50.3224950000001, longitude: -4.51055599999995 }, Coordinate { latitude: 50.3222200000001, longitude: -4.54333399999996 }, Coordinate { latitude: 50.323608, longitude: -4.64527800000002 }, Coordinate { latitude: 50.3258290000001, longitude: -4.67861199999999 }, Coordinate { latitude: 50.311386, longitude: -4.76250099999999 }, Coordinate { latitude: 50.231667, longitude: -4.85750000000002 }, Coordinate { latitude: 50.1933290000001, longitude: -4.95277799999997 }, Coordinate { latitude: 50.1711040000001, longitude: -5.04805599999992 }, Coordinate { latitude: 50.1391600000001, longitude: -5.05944499999998 }, Coordinate { latitude: 50.0847170000001, longitude: -5.07527799999997 }, Coordinate { latitude: 50.0824970000001, longitude: -5.07111199999997 }, Coordinate { latitude: 50.07972, longitude: -5.06861099999998 }, Coordinate { latitude: 50.061943, longitude: -5.05472300000002 }, Coordinate { latitude: 50.0583270000001, longitude: -5.05361199999993 }, Coordinate { latitude: 50.049721, longitude: -5.05555600000002 }, Coordinate { latitude: 50.0424960000001, longitude: -5.05944499999998 }, Coordinate { latitude: 50.0374980000001, longitude: -5.06555600000002 }, Coordinate { latitude: 50.0227740000001, longitude: -5.08611200000001 }, Coordinate { latitude: 50.0044400000001, longitude: -5.15916700000002 }, Coordinate { latitude: 50.0019380000001, longitude: -5.16222299999993 }, Coordinate { latitude: 49.9827730000001, longitude: -5.17666700000001 }, Coordinate { latitude: 49.976387, longitude: -5.18111099999999 }, Coordinate { latitude: 49.9552760000001, longitude: -5.19305599999996 }, Coordinate { latitude: 49.9555510000001, longitude: -5.19888999999995 }, Coordinate { latitude: 49.957771, longitude: -5.20277800000002 }, Coordinate { latitude: 49.973328, longitude: -5.22861199999994 }, Coordinate { latitude: 49.98111, longitude: -5.23749999999995 }, Coordinate { latitude: 50.000832, longitude: -5.25583399999999 }, Coordinate { latitude: 50.004166, longitude: -5.25722300000001 }, Coordinate { latitude: 50.0077740000001, longitude: -5.25694499999997 }, Coordinate { latitude: 50.0183260000001, longitude: -5.25111199999998 }, Coordinate { latitude: 50.023048, longitude: -5.250834 }, Coordinate { latitude: 50.029999, longitude: -5.253334 }, Coordinate { latitude: 50.059715, longitude: -5.27666799999992 }, Coordinate { latitude: 50.069443, longitude: -5.28972199999998 }, Coordinate { latitude: 50.0913850000001, longitude: -5.33361099999996 }, Coordinate { latitude: 50.124992, longitude: -5.47055599999993 }, Coordinate { latitude: 50.1269380000001, longitude: -5.48250000000002 }, Coordinate { latitude: 50.12722, longitude: -5.48944499999999 }, Coordinate { latitude: 50.126106, longitude: -5.50111199999992 }, Coordinate { latitude: 50.123886, longitude: -5.51139000000001 }, Coordinate { latitude: 50.1180499999999, longitude: -5.53083399999997 }, Coordinate { latitude: 50.1133270000001, longitude: -5.53749999999997 }, Coordinate { latitude: 50.1061100000001, longitude: -5.54138899999992 }, Coordinate { latitude: 50.1016620000001, longitude: -5.54194499999994 }, Coordinate { latitude: 50.0866620000001, longitude: -5.53805599999993 }, Coordinate { latitude: 50.0824970000001, longitude: -5.53777799999995 }, Coordinate { latitude: 50.0738830000001, longitude: -5.53944499999994 }, Coordinate { latitude: 50.0672150000001, longitude: -5.54388899999992 }, Coordinate { latitude: 50.059441, longitude: -5.55194499999999 }, Coordinate { latitude: 50.0547180000001, longitude: -5.559167 }, Coordinate { latitude: 50.0511090000001, longitude: -5.56722299999996 }, Coordinate { latitude: 50.0477750000001, longitude: -5.58277800000002 }, Coordinate { latitude: 50.036659, longitude: -5.65388999999993 }, Coordinate { latitude: 50.035828, longitude: -5.65972199999993 }, Coordinate { latitude: 50.0363850000001, longitude: -5.66666700000002 }, Coordinate { latitude: 50.0386050000001, longitude: -5.67777799999999 }, Coordinate { latitude: 50.041939, longitude: -5.68749999999994 }, Coordinate { latitude: 50.0536040000001, longitude: -5.71250099999997 }, Coordinate { latitude: 50.059441, longitude: -5.71750099999997 }, Coordinate { latitude: 50.063049, longitude: -5.71861199999995 }, Coordinate { latitude: 50.0672150000001, longitude: -5.71861199999995 }, Coordinate { latitude: 50.1291660000001, longitude: -5.70999999999998 }, Coordinate { latitude: 50.1530530000001, longitude: -5.69583399999993 }, Coordinate { latitude: 50.157219, longitude: -5.68805599999996 }, Coordinate { latitude: 50.2052760000001, longitude: -5.54638999999992 }, Coordinate { latitude: 50.214165, longitude: -5.51166699999993 }, Coordinate { latitude: 50.2169420000001, longitude: -5.49583299999995 }, Coordinate { latitude: 50.214996, longitude: -5.48361199999999 }, Coordinate { latitude: 50.213333, longitude: -5.47888899999992 }, Coordinate { latitude: 50.207497, longitude: -5.47388899999993 }, Coordinate { latitude: 50.200554, longitude: -5.47111100000001 }, Coordinate { latitude: 50.1977770000001, longitude: -5.46888899999993 }, Coordinate { latitude: 50.1963880000001, longitude: -5.46305599999994 }, Coordinate { latitude: 50.192497, longitude: -5.43944499999992 }, Coordinate { latitude: 50.192772, longitude: -5.43277799999993 }, Coordinate { latitude: 50.193886, longitude: -5.42777799999993 }, Coordinate { latitude: 50.273888, longitude: -5.26805599999994 }, Coordinate { latitude: 50.342499, longitude: -5.15388999999993 }, Coordinate { latitude: 50.344994, longitude: -5.15027799999996 }, Coordinate { latitude: 50.422218, longitude: -5.05194499999993 }, Coordinate { latitude: 50.4249950000001, longitude: -5.04888899999992 }, Coordinate { latitude: 50.431389, longitude: -5.04416800000001 }, Coordinate { latitude: 50.4666600000001, longitude: -5.02444500000001 }, Coordinate { latitude: 50.470276, longitude: -5.02388999999999 }, Coordinate { latitude: 50.4769439999999, longitude: -5.02722299999999 }, Coordinate { latitude: 50.4958270000001, longitude: -5.03944499999994 }, Coordinate { latitude: 50.500275, longitude: -5.03888899999998 }, Coordinate { latitude: 50.540276, longitude: -5.02111100000002 }, Coordinate { latitude: 50.5449980000001, longitude: -5.01388900000001 }, Coordinate { latitude: 50.5772170000001, longitude: -4.91583299999996 }, Coordinate { latitude: 50.578888, longitude: -4.89749999999992 }, Coordinate { latitude: 50.578888, longitude: -4.87388900000002 }, Coordinate { latitude: 50.5894390000001, longitude: -4.80138999999997 }, Coordinate { latitude: 50.5927730000001, longitude: -4.78583300000003 }, Coordinate { latitude: 50.5944440000001, longitude: -4.78138899999993 }, Coordinate { latitude: 50.6019440000001, longitude: -4.77166699999998 }, Coordinate { latitude: 50.614716, longitude: -4.76166699999999 }, Coordinate { latitude: 50.6413880000001, longitude: -4.751667 }, Coordinate { latitude: 50.6674960000001, longitude: -4.74361099999993 }, Coordinate { latitude: 50.6883320000001, longitude: -4.70083399999993 }, Coordinate { latitude: 50.7152710000001, longitude: -4.65138899999999 }, Coordinate { latitude: 50.7736049999999, longitude: -4.56472300000002 }, Coordinate { latitude: 50.778885, longitude: -4.55805600000002 }, Coordinate { latitude: 50.7852710000001, longitude: -4.55361199999993 }, Coordinate { latitude: 50.8024980000001, longitude: -4.54944499999993 }, Coordinate { latitude: 50.816383, longitude: -4.54750099999995 }, Coordinate { latitude: 50.8249970000001, longitude: -4.54722299999997 }, Coordinate { latitude: 50.8547210000001, longitude: -4.54638999999997 }, Coordinate { latitude: 50.858887, longitude: -4.54666699999996 }, Coordinate { latitude: 50.862221, longitude: -4.54833399999995 }, Coordinate { latitude: 50.9269410000001, longitude: -4.54333399999996 }, Coordinate { latitude: 51.009995, longitude: -4.52722299999999 }, Coordinate { latitude: 51.015274, longitude: -4.52361200000001 }, Coordinate { latitude: 51.015831, longitude: -4.51722199999995 }, Coordinate { latitude: 51.01416, longitude: -4.47444499999995 }, Coordinate { latitude: 51.009995, longitude: -4.43055599999997 }, Coordinate { latitude: 51.0091630000001, longitude: -4.42416699999995 }, Coordinate { latitude: 51.002777, longitude: -4.411945 }, Coordinate { latitude: 50.991104, longitude: -4.37639000000001 }, Coordinate { latitude: 50.9894410000001, longitude: -4.35777899999994 }, Coordinate { latitude: 50.990555, longitude: -4.33944500000001 }, Coordinate { latitude: 50.9952770000001, longitude: -4.32472199999995 }, Coordinate { latitude: 51.004166, longitude: -4.30361199999999 }, Coordinate { latitude: 51.0436100000001, longitude: -4.24138900000003 }, Coordinate { latitude: 51.0455550000001, longitude: -4.23833399999995 }, Coordinate { latitude: 51.048607, longitude: -4.23416699999996 }, Coordinate { latitude: 51.070549, longitude: -4.21166699999992 }, Coordinate { latitude: 51.0741650000001, longitude: -4.20888899999994 }, Coordinate { latitude: 51.11055, longitude: -4.22027800000001 }, Coordinate { latitude: 51.1863859999999, longitude: -4.22972299999998 }, Coordinate { latitude: 51.189163, longitude: -4.22638899999998 }, Coordinate { latitude: 51.195831, longitude: -4.20861100000002 }, Coordinate { latitude: 51.198326, longitude: -4.19861099999997 }, Coordinate { latitude: 51.2122190000001, longitude: -4.11666700000001 }, Coordinate { latitude: 51.213882, longitude: -4.07166699999999 }, Coordinate { latitude: 51.216942, longitude: -3.98472299999992 }, Coordinate { latitude: 51.224159, longitude: -3.88388900000001 }, Coordinate { latitude: 51.239166, longitude: -3.79250000000002 }, Coordinate { latitude: 51.2299960000001, longitude: -3.70027799999997 }, Coordinate { latitude: 51.2180480000001, longitude: -3.63222299999995 }, Coordinate { latitude: 51.21666, longitude: -3.61861099999999 }, Coordinate { latitude: 51.220276, longitude: -3.59694499999995 }, Coordinate { latitude: 51.2233279999999, longitude: -3.58749999999998 }, Coordinate { latitude: 51.2288820000001, longitude: -3.57472200000001 }, Coordinate { latitude: 51.231667, longitude: -3.56555600000002 }, Coordinate { latitude: 51.2238850000001, longitude: -3.51055599999995 }, Coordinate { latitude: 51.222771, longitude: -3.50388900000002 }, Coordinate { latitude: 51.2086110000001, longitude: -3.44249999999994 }, Coordinate { latitude: 51.2069400000001, longitude: -3.43777799999998 }, Coordinate { latitude: 51.204994, longitude: -3.43444499999998 }, Coordinate { latitude: 51.1930540000001, longitude: -3.42333400000001 }, Coordinate { latitude: 51.188049, longitude: -3.41666700000002 }, Coordinate { latitude: 51.1844410000001, longitude: -3.40861099999995 }, Coordinate { latitude: 51.181664, longitude: -3.39722299999994 }, Coordinate { latitude: 51.1811070000001, longitude: -3.38999999999999 }, Coordinate { latitude: 51.1811070000001, longitude: -3.37027799999993 }, Coordinate { latitude: 51.1811070000001, longitude: -3.30138899999992 }, Coordinate { latitude: 51.206108, longitude: -3.02833399999992 }, Coordinate { latitude: 51.2497180000001, longitude: -3.00944499999997 }, Coordinate { latitude: 51.2561040000001, longitude: -3.01333399999999 }, Coordinate { latitude: 51.2597200000001, longitude: -3.01416699999999 }, Coordinate { latitude: 51.272774, longitude: -3.01333399999999 }, Coordinate { latitude: 51.3072200000001, longitude: -3.00694499999997 }, Coordinate { latitude: 51.3749920000001, longitude: -2.95999999999992 }, Coordinate { latitude: 51.444717, longitude: -2.852778 }, Coordinate { latitude: 51.4891660000001, longitude: -2.770556 }, Coordinate { latitude: 51.5638890000001, longitude: -2.65333399999992 }, Coordinate { latitude: 51.578888, longitude: -2.63944499999997 }, Coordinate { latitude: 51.6572190000001, longitude: -2.55305599999997 }, Coordinate { latitude: 51.724442, longitude: -2.47166699999997 }, Coordinate { latitude: 51.7302700000001, longitude: -2.45916699999992 }, Coordinate { latitude: 51.733055, longitude: -2.45055599999995 }, Coordinate { latitude: 51.7369380000001, longitude: -2.42888900000003 }, Coordinate { latitude: 51.7397160000001, longitude: -2.40638899999999 }, Coordinate { latitude: 51.741104, longitude: -2.40138899999999 }, Coordinate { latitude: 51.7441640000001, longitude: -2.39194500000002 }, Coordinate { latitude: 51.7491610000001, longitude: -2.38472200000001 }, Coordinate { latitude: 51.7555540000001, longitude: -2.37999999999994 }, Coordinate { latitude: 51.7602770000001, longitude: -2.37888900000002 }, Coordinate { latitude: 51.763885, longitude: -2.37972300000001 }, Coordinate { latitude: 51.7672200000001, longitude: -2.38138900000001 }, Coordinate { latitude: 51.7727740000001, longitude: -2.38694500000003 }, Coordinate { latitude: 51.7749940000001, longitude: -2.39083299999993 }, Coordinate { latitude: 51.776382, longitude: -2.39666699999998 }, Coordinate { latitude: 51.7466660000001, longitude: -2.46055599999994 }, Coordinate { latitude: 51.6777730000001, longitude: -2.578889 }, Coordinate { latitude: 51.644165, longitude: -2.629167 }, Coordinate { latitude: 51.6149980000001, longitude: -2.66499999999996 }, Coordinate { latitude: 51.6069410000001, longitude: -2.67472299999997 }, Coordinate { latitude: 51.5894390000001, longitude: -2.69888900000001 }, Coordinate { latitude: 51.5808260000001, longitude: -2.71472299999994 }, Coordinate { latitude: 51.5449980000001, longitude: -2.84777800000001 }, Coordinate { latitude: 51.5386050000001, longitude: -2.89277799999996 }, Coordinate { latitude: 51.537773, longitude: -2.91888899999992 }, Coordinate { latitude: 51.5397190000001, longitude: -2.95472199999995 }, Coordinate { latitude: 51.5416640000001, longitude: -2.96638899999999 }, Coordinate { latitude: 51.525276, longitude: -3.02111099999996 }, Coordinate { latitude: 51.489998, longitude: -3.11555600000003 }, Coordinate { latitude: 51.4849930000001, longitude: -3.12194499999998 }, Coordinate { latitude: 51.4788820000001, longitude: -3.12777799999998 }, Coordinate { latitude: 51.4530490000001, longitude: -3.15166699999992 }, Coordinate { latitude: 51.4372180000001, longitude: -3.16027800000001 }, Coordinate { latitude: 51.433609, longitude: -3.15861100000001 }, Coordinate { latitude: 51.4299930000001, longitude: -3.15805599999999 }, Coordinate { latitude: 51.421387, longitude: -3.15861100000001 }, Coordinate { latitude: 51.41333, longitude: -3.16166699999997 }, Coordinate { latitude: 51.409721, longitude: -3.16388899999998 }, Coordinate { latitude: 51.406662, longitude: -3.16638899999998 }, Coordinate { latitude: 51.399162, longitude: -3.17666699999995 }, Coordinate { latitude: 51.3955540000001, longitude: -3.18555600000002 }, Coordinate { latitude: 51.3805540000001, longitude: -3.26833299999993 }, Coordinate { latitude: 51.379715, longitude: -3.27361200000001 }, Coordinate { latitude: 51.3786090000001, longitude: -3.34611100000001 }, Coordinate { latitude: 51.3786090000001, longitude: -3.35944499999999 }, Coordinate { latitude: 51.379715, longitude: -3.40333399999997 }, Coordinate { latitude: 51.3805540000001, longitude: -3.41638899999992 }, Coordinate { latitude: 51.38472, longitude: -3.45111100000003 }, Coordinate { latitude: 51.389999, longitude: -3.48861099999993 }, Coordinate { latitude: 51.3977740000001, longitude: -3.54249999999996 }, Coordinate { latitude: 51.4055480000001, longitude: -3.56027799999993 }, Coordinate { latitude: 51.473885, longitude: -3.67194499999994 }, Coordinate { latitude: 51.525276, longitude: -3.74944399999993 }, Coordinate { latitude: 51.5333400000001, longitude: -3.75375699999995 }, Coordinate { latitude: 51.544441, longitude: -3.76111100000003 }, Coordinate { latitude: 51.567497, longitude: -3.78166699999997 }, Coordinate { latitude: 51.619164, longitude: -3.835556 }, Coordinate { latitude: 51.6208270000001, longitude: -3.84027800000001 }, Coordinate { latitude: 51.612778, longitude: -3.94972200000001 }, Coordinate { latitude: 51.609718, longitude: -3.96555599999999 }, Coordinate { latitude: 51.542496, longitude: -4.20027799999997 }, Coordinate { latitude: 51.5347210000001, longitude: -4.20222299999995 }, Coordinate { latitude: 51.532219, longitude: -4.20555599999994 }, Coordinate { latitude: 51.5316620000001, longitude: -4.21138999999994 }, Coordinate { latitude: 51.5327760000001, longitude: -4.21722299999999 }, Coordinate { latitude: 51.5408330000001, longitude: -4.24277799999993 }, Coordinate { latitude: 51.5566640000001, longitude: -4.27777899999995 }, Coordinate { latitude: 51.602493, longitude: -4.29305599999992 }, Coordinate { latitude: 51.606667, longitude: -4.29305599999992 }, Coordinate { latitude: 51.6102750000001, longitude: -4.291112 }, Coordinate { latitude: 51.628609, longitude: -4.25055600000002 }, Coordinate { latitude: 51.6330490000001, longitude: -4.231945 }, Coordinate { latitude: 51.626663, longitude: -4.21138999999994 }, Coordinate { latitude: 51.622498, longitude: -4.18055600000002 }, Coordinate { latitude: 51.622215, longitude: -4.17444499999993 }, Coordinate { latitude: 51.623329, longitude: -4.16249999999997 }, Coordinate { latitude: 51.6341630000001, longitude: -4.11638899999997 }, Coordinate { latitude: 51.6461110000001, longitude: -4.078056 }, Coordinate { latitude: 51.648605, longitude: -4.07500099999999 }, Coordinate { latitude: 51.6619420000001, longitude: -4.06555600000002 }, Coordinate { latitude: 51.6658330000001, longitude: -4.06389000000001 }, Coordinate { latitude: 51.6697160000001, longitude: -4.065001 }, Coordinate { latitude: 51.6746439999999, longitude: -4.07013599999999 }, Coordinate { latitude: 51.677216, longitude: -4.07472200000001 }, Coordinate { latitude: 51.6791610000001, longitude: -4.19749999999999 }, Coordinate { latitude: 51.6769410000001, longitude: -4.26222200000001 }, Coordinate { latitude: 51.737221, longitude: -4.43611099999993 }, Coordinate { latitude: 51.734161, longitude: -4.57444499999997 }, Coordinate { latitude: 51.728882, longitude: -4.62833399999994 }, Coordinate { latitude: 51.726662, longitude: -4.64583399999998 }, Coordinate { latitude: 51.7224960000001, longitude: -4.66722299999992 }, Coordinate { latitude: 51.7188870000001, longitude: -4.67583400000001 }, Coordinate { latitude: 51.7136080000001, longitude: -4.682501 }, Coordinate { latitude: 51.706108, longitude: -4.68611099999998 }, Coordinate { latitude: 51.6894380000001, longitude: -4.686667 }, Coordinate { latitude: 51.666664, longitude: -4.69027799999998 }, Coordinate { latitude: 51.6502760000001, longitude: -4.70861100000002 }, Coordinate { latitude: 51.648888, longitude: -4.71333399999992 }, Coordinate { latitude: 51.631943, longitude: -4.78333400000002 }, Coordinate { latitude: 51.632774, longitude: -4.78972199999993 }, Coordinate { latitude: 51.634438, longitude: -4.79472299999998 }, Coordinate { latitude: 51.6405490000001, longitude: -4.80722199999997 }, Coordinate { latitude: 51.6449970000001, longitude: -4.82777800000002 }, Coordinate { latitude: 51.6458280000001, longitude: -4.83444500000002 }, Coordinate { latitude: 51.645271, longitude: -4.84027899999995 }, Coordinate { latitude: 51.640831, longitude: -4.86194499999993 }, Coordinate { latitude: 51.639442, longitude: -4.86638900000003 }, Coordinate { latitude: 51.626938, longitude: -4.89027800000002 }, Coordinate { latitude: 51.594162, longitude: -4.94138900000002 }, Coordinate { latitude: 51.606384, longitude: -5.00527899999997 }, Coordinate { latitude: 51.616661, longitude: -5.04249999999996 }, Coordinate { latitude: 51.620277, longitude: -5.05139000000003 }, Coordinate { latitude: 51.6686100000001, longitude: -5.021278 }, Coordinate { latitude: 51.675774, longitude: -4.97061199999996 }, Coordinate { latitude: 51.696938, longitude: -4.90500100000003 }, Coordinate { latitude: 51.6994400000001, longitude: -4.89416699999992 }, Coordinate { latitude: 51.7133330000001, longitude: -4.86111199999993 }, Coordinate { latitude: 51.7227710000001, longitude: -4.86722300000002 }, Coordinate { latitude: 51.7466660000001, longitude: -4.88444499999997 }, Coordinate { latitude: 51.7327730000001, longitude: -4.88999999999993 }, Coordinate { latitude: 51.7247160000001, longitude: -4.89055599999995 }, Coordinate { latitude: 51.7211070000001, longitude: -4.89250099999992 }, Coordinate { latitude: 51.7158279999999, longitude: -4.89944500000001 }, Coordinate { latitude: 51.7138820000001, longitude: -4.90416699999992 }, Coordinate { latitude: 51.711105, longitude: -4.91333399999996 }, Coordinate { latitude: 51.703995, longitude: -5.00405599999999 }, Coordinate { latitude: 51.702995, longitude: -5.01072299999998 }, Coordinate { latitude: 51.7049940000001, longitude: -5.06505600000003 }, Coordinate { latitude: 51.7088850000001, longitude: -5.19111199999998 }, Coordinate { latitude: 51.723053, longitude: -5.22861199999994 }, Coordinate { latitude: 51.7302700000001, longitude: -5.24694499999993 }, Coordinate { latitude: 51.762215, longitude: -5.16111199999995 }, Coordinate { latitude: 51.764999, longitude: -5.15111199999996 }, Coordinate { latitude: 51.765549, longitude: -5.14527799999996 }, Coordinate { latitude: 51.765274, longitude: -5.12416699999994 }, Coordinate { latitude: 51.766663, longitude: -5.11222299999997 }, Coordinate { latitude: 51.7683260000001, longitude: -5.10777899999999 }, Coordinate { latitude: 51.770828, longitude: -5.104445 }, Coordinate { latitude: 51.778885, longitude: -5.101945 }, Coordinate { latitude: 51.7830510000001, longitude: -5.101945 }, Coordinate { latitude: 51.8313830000001, longitude: -5.11472199999997 }, Coordinate { latitude: 51.835274, longitude: -5.11583399999995 }, Coordinate { latitude: 51.845551, longitude: -5.12000099999995 }, Coordinate { latitude: 51.848885, longitude: -5.12194499999993 }, Coordinate { latitude: 51.854439, longitude: -5.12722300000002 }, Coordinate { latitude: 51.8583300000001, longitude: -5.13611100000003 }, Coordinate { latitude: 51.8691640000001, longitude: -5.181667 }, Coordinate { latitude: 51.8699950000001, longitude: -5.18833399999994 }, Coordinate { latitude: 51.870552, longitude: -5.21333399999992 }, Coordinate { latitude: 51.870552, longitude: -5.25888900000001 }, Coordinate { latitude: 51.9163820000001, longitude: -5.23916700000001 }, Coordinate { latitude: 51.959717, longitude: -5.101945 }, Coordinate { latitude: 51.9613880000001, longitude: -5.09694500000001 }, Coordinate { latitude: 51.9752730000001, longitude: -5.08166699999992 }, Coordinate { latitude: 51.9786070000001, longitude: -5.07972199999995 }, Coordinate { latitude: 51.996109, longitude: -5.07666699999999 }, Coordinate { latitude: 52.0138850000001, longitude: -4.84444499999995 }, Coordinate { latitude: 52.015274, longitude: -4.832223 }, Coordinate { latitude: 52.01722, longitude: -4.82833399999993 }, Coordinate { latitude: 52.0644380000001, longitude: -4.76777799999996 }, Coordinate { latitude: 52.0730510000001, longitude: -4.75916699999999 }, Coordinate { latitude: 52.0902710000001, longitude: -4.74611199999993 }, Coordinate { latitude: 52.103607, longitude: -4.73694499999993 }, Coordinate { latitude: 52.1130520000001, longitude: -4.72277800000001 }, Coordinate { latitude: 52.130272, longitude: -4.66944499999994 }, Coordinate { latitude: 52.1341630000001, longitude: -4.64694499999996 }, Coordinate { latitude: 52.13472, longitude: -4.64111100000002 }, Coordinate { latitude: 52.1341630000001, longitude: -4.62666699999994 }, Coordinate { latitude: 52.13166, longitude: -4.59055599999994 }, Coordinate { latitude: 52.1308290000001, longitude: -4.52722299999999 }, Coordinate { latitude: 52.1363830000001, longitude: -4.5 }, Coordinate { latitude: 52.1377719999999, longitude: -4.49527799999998 }, Coordinate { latitude: 52.222496, longitude: -4.291945 }, Coordinate { latitude: 52.248886, longitude: -4.23166799999996 }, Coordinate { latitude: 52.2763820000001, longitude: -4.19361099999998 }, Coordinate { latitude: 52.320274, longitude: -4.143056 }, Coordinate { latitude: 52.334717, longitude: -4.13083399999994 }, Coordinate { latitude: 52.3819430000001, longitude: -4.09833300000003 }, Coordinate { latitude: 52.3897170000001, longitude: -4.09500000000003 }, Coordinate { latitude: 52.397774, longitude: -4.09194499999995 }, Coordinate { latitude: 52.4858320000001, longitude: -4.05972300000002 }, Coordinate { latitude: 52.506104, longitude: -4.06111099999993 }, Coordinate { latitude: 52.5533290000001, longitude: -4.080556 }, Coordinate { latitude: 52.59861, longitude: -4.12388899999996 }, Coordinate { latitude: 52.6016620000001, longitude: -4.12638999999996 }, Coordinate { latitude: 52.60527, longitude: -4.12750099999994 }, Coordinate { latitude: 52.6094440000001, longitude: -4.12611199999998 }, Coordinate { latitude: 52.650833, longitude: -4.10638899999992 }, Coordinate { latitude: 52.71666, longitude: -4.05333399999995 }, Coordinate { latitude: 52.724159, longitude: -4.063334 }, Coordinate { latitude: 52.7777710000001, longitude: -4.13055599999996 }, Coordinate { latitude: 52.795273, longitude: -4.14611100000002 }, Coordinate { latitude: 52.798332, longitude: -4.14833399999998 }, Coordinate { latitude: 52.801941, longitude: -4.14944500000001 }, Coordinate { latitude: 52.8061070000001, longitude: -4.14944500000001 }, Coordinate { latitude: 52.8766630000001, longitude: -4.13639000000001 }, Coordinate { latitude: 52.881104, longitude: -4.13499999999993 }, Coordinate { latitude: 52.884163, longitude: -4.13305600000001 }, Coordinate { latitude: 52.890274, longitude: -4.12666699999994 }, Coordinate { latitude: 52.8944400000001, longitude: -4.11833399999995 }, Coordinate { latitude: 52.9144440000001, longitude: -4.13361200000003 }, Coordinate { latitude: 52.914993, longitude: -4.23333399999996 }, Coordinate { latitude: 52.9055480000001, longitude: -4.30944499999998 }, Coordinate { latitude: 52.9044420000001, longitude: -4.31638899999996 }, Coordinate { latitude: 52.8847200000001, longitude: -4.41416700000002 }, Coordinate { latitude: 52.8724980000001, longitude: -4.44055600000002 }, Coordinate { latitude: 52.854996, longitude: -4.47722199999993 }, Coordinate { latitude: 52.829437, longitude: -4.50027799999998 }, Coordinate { latitude: 52.793053, longitude: -4.53944499999994 }, Coordinate { latitude: 52.7813870000001, longitude: -4.727778 }, Coordinate { latitude: 52.7808299999999, longitude: -4.74083399999995 }, Coordinate { latitude: 52.781662, longitude: -4.7475 }, Coordinate { latitude: 52.7855530000001, longitude: -4.75611099999992 }, Coordinate { latitude: 52.7889710000001, longitude: -4.76086299999997 }, Coordinate { latitude: 52.8069380000001, longitude: -4.75222300000002 }, Coordinate { latitude: 52.819443, longitude: -4.74111199999993 }, Coordinate { latitude: 52.836105, longitude: -4.72194500000001 }, Coordinate { latitude: 52.88694, longitude: -4.65111199999996 }, Coordinate { latitude: 52.909164, longitude: -4.61888999999996 }, Coordinate { latitude: 52.9238820000001, longitude: -4.58611199999996 }, Coordinate { latitude: 52.928886, longitude: -4.55277799999993 }, Coordinate { latitude: 52.93055, longitude: -4.54027799999994 }, Coordinate { latitude: 52.935829, longitude: -4.52666799999992 }, Coordinate { latitude: 52.946106, longitude: -4.50583399999994 }, Coordinate { latitude: 52.970276, longitude: -4.46250099999997 }, Coordinate { latitude: 53.0263820000001, longitude: -4.36444499999993 }, Coordinate { latitude: 53.031387, longitude: -4.35749999999996 }, Coordinate { latitude: 53.0344390000001, longitude: -4.35472299999998 }, Coordinate { latitude: 53.041664, longitude: -4.35055599999998 }, Coordinate { latitude: 53.062775, longitude: -4.34499999999997 }, Coordinate { latitude: 53.0674970000001, longitude: -4.34416699999997 }, Coordinate { latitude: 53.112221, longitude: -4.33027800000002 }, Coordinate { latitude: 53.2061079999999, longitude: -4.19638899999995 }, Coordinate { latitude: 53.225555, longitude: -4.15333399999997 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 58.729996, longitude: -2.93944499999998 }, Coordinate { latitude: 58.7305530000001, longitude: -2.94805599999995 }, Coordinate { latitude: 58.7347180000001, longitude: -2.95777800000002 }, Coordinate { latitude: 58.741943, longitude: -2.97055599999999 }, Coordinate { latitude: 58.750275, longitude: -2.97999999999996 }, Coordinate { latitude: 58.8180540000001, longitude: -3.036945 }, Coordinate { latitude: 58.820831, longitude: -3.03361100000001 }, Coordinate { latitude: 58.823051, longitude: -3.02888899999994 }, Coordinate { latitude: 58.831665, longitude: -3.00999999999999 }, Coordinate { latitude: 58.8330540000001, longitude: -3.00444499999998 }, Coordinate { latitude: 58.835274, longitude: -2.97472199999999 }, Coordinate { latitude: 58.838882, longitude: -2.91611099999994 }, Coordinate { latitude: 58.838333, longitude: -2.89916699999998 }, Coordinate { latitude: 58.836937, longitude: -2.89416699999998 }, Coordinate { latitude: 58.8319400000001, longitude: -2.88638900000001 }, Coordinate { latitude: 58.824165, longitude: -2.87777799999992 }, Coordinate { latitude: 58.8202740000001, longitude: -2.87666699999994 }, Coordinate { latitude: 58.7338870000001, longitude: -2.91388899999993 }, Coordinate { latitude: 58.731941, longitude: -2.91833400000002 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 58.775551, longitude: -3.28888899999998 }, Coordinate { latitude: 58.7761080000001, longitude: -3.29583400000001 }, Coordinate { latitude: 58.7780530000001, longitude: -3.30083400000001 }, Coordinate { latitude: 58.871384, longitude: -3.43111099999999 }, Coordinate { latitude: 58.8747180000001, longitude: -3.43305599999997 }, Coordinate { latitude: 58.878883, longitude: -3.43305599999997 }, Coordinate { latitude: 58.9041600000001, longitude: -3.41805599999992 }, Coordinate { latitude: 58.9105530000001, longitude: -3.41222199999993 }, Coordinate { latitude: 58.917221, longitude: -3.39805599999994 }, Coordinate { latitude: 58.9269410000001, longitude: -3.34916699999997 }, Coordinate { latitude: 58.927498, longitude: -3.33555599999994 }, Coordinate { latitude: 58.887215, longitude: -3.23305599999998 }, Coordinate { latitude: 58.8849950000001, longitude: -3.22833300000002 }, Coordinate { latitude: 58.8741610000001, longitude: -3.21472299999994 }, Coordinate { latitude: 58.804161, longitude: -3.13638899999995 }, Coordinate { latitude: 58.8008270000001, longitude: -3.13472199999995 }, Coordinate { latitude: 58.786659, longitude: -3.13694500000003 }, Coordinate { latitude: 58.784721, longitude: -3.14166699999993 }, Coordinate { latitude: 58.781105, longitude: -3.16027800000001 }, Coordinate { latitude: 58.77916, longitude: -3.18083299999995 }, Coordinate { latitude: 58.775551, longitude: -3.23138899999992 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 58.9177700000001, longitude: -2.75583399999994 }, Coordinate { latitude: 58.878883, longitude: -2.82444499999997 }, Coordinate { latitude: 58.893326, longitude: -2.86916699999995 }, Coordinate { latitude: 58.9394380000001, longitude: -2.96999999999997 }, Coordinate { latitude: 58.939995, longitude: -3.00833399999999 }, Coordinate { latitude: 58.9358290000001, longitude: -3.05722199999997 }, Coordinate { latitude: 58.9280550000001, longitude: -3.11055599999992 }, Coordinate { latitude: 58.9233320000001, longitude: -3.11972200000002 }, Coordinate { latitude: 58.9191670000001, longitude: -3.11972200000002 }, Coordinate { latitude: 58.910828, longitude: -3.17222299999997 }, Coordinate { latitude: 58.909996, longitude: -3.188334 }, Coordinate { latitude: 58.9111100000001, longitude: -3.19499999999999 }, Coordinate { latitude: 58.9458310000001, longitude: -3.30333400000001 }, Coordinate { latitude: 58.9499969999999, longitude: -3.313334 }, Coordinate { latitude: 58.9658280000001, longitude: -3.34555599999999 }, Coordinate { latitude: 58.992218, longitude: -3.36111099999999 }, Coordinate { latitude: 58.9955519999999, longitude: -3.36305599999997 }, Coordinate { latitude: 59.009995, longitude: -3.36805600000002 }, Coordinate { latitude: 59.01416, longitude: -3.36805600000002 }, Coordinate { latitude: 59.1063839999999, longitude: -3.35138899999998 }, Coordinate { latitude: 59.1099930000001, longitude: -3.350278 }, Coordinate { latitude: 59.12944, longitude: -3.3175 }, Coordinate { latitude: 59.139999, longitude: -3.27777799999996 }, Coordinate { latitude: 59.141388, longitude: -3.272223 }, Coordinate { latitude: 59.146111, longitude: -3.23888899999997 }, Coordinate { latitude: 59.148605, longitude: -3.21888899999993 }, Coordinate { latitude: 59.148605, longitude: -3.20249999999999 }, Coordinate { latitude: 59.1472170000001, longitude: -3.19583399999999 }, Coordinate { latitude: 59.121666, longitude: -3.07694500000002 }, Coordinate { latitude: 59.1191640000001, longitude: -3.07305600000001 }, Coordinate { latitude: 59.069717, longitude: -2.998333 }, Coordinate { latitude: 59.0666660000001, longitude: -2.99527799999993 }, Coordinate { latitude: 59.0558320000001, longitude: -2.995833 }, Coordinate { latitude: 58.998329, longitude: -2.94722199999995 }, Coordinate { latitude: 58.975555, longitude: -2.85222199999998 }, Coordinate { latitude: 58.9513850000001, longitude: -2.79305599999998 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 59.1841660000001, longitude: -2.68583299999995 }, Coordinate { latitude: 59.1866610000001, longitude: -2.68972300000002 }, Coordinate { latitude: 59.1899950000001, longitude: -2.691667 }, Coordinate { latitude: 59.197495, longitude: -2.69361099999992 }, Coordinate { latitude: 59.2102740000001, longitude: -2.6925 }, Coordinate { latitude: 59.2144390000001, longitude: -2.69055600000002 }, Coordinate { latitude: 59.2208329999999, longitude: -2.68444499999993 }, Coordinate { latitude: 59.29055, longitude: -2.59277799999995 }, Coordinate { latitude: 59.3030550000001, longitude: -2.55555599999997 }, Coordinate { latitude: 59.304993, longitude: -2.53444500000001 }, Coordinate { latitude: 59.313606, longitude: -2.41444399999995 }, Coordinate { latitude: 59.313889, longitude: -2.40722199999999 }, Coordinate { latitude: 59.312775, longitude: -2.40222299999999 }, Coordinate { latitude: 59.310272, longitude: -2.39999999999998 }, Coordinate { latitude: 59.303329, longitude: -2.397223 }, Coordinate { latitude: 59.283051, longitude: -2.39027800000002 }, Coordinate { latitude: 59.2797160000001, longitude: -2.38999999999993 }, Coordinate { latitude: 59.244995, longitude: -2.49555600000002 }, Coordinate { latitude: 59.2422180000001, longitude: -2.57083399999993 }, Coordinate { latitude: 59.2422180000001, longitude: -2.57722200000001 }, Coordinate { latitude: 59.236107, longitude: -2.62055600000002 }, Coordinate { latitude: 59.233604, longitude: -2.625 }, Coordinate { latitude: 59.195831, longitude: -2.68138900000002 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 59.268051, longitude: -2.84972199999999 }, Coordinate { latitude: 59.249443, longitude: -2.85305599999998 }, Coordinate { latitude: 59.2286070000001, longitude: -2.87749999999994 }, Coordinate { latitude: 59.251938, longitude: -2.87305600000002 }, Coordinate { latitude: 59.2561040000001, longitude: -2.87305600000002 }, Coordinate { latitude: 59.258606, longitude: -2.87694499999992 }, Coordinate { latitude: 59.283607, longitude: -2.936667 }, Coordinate { latitude: 59.2877730000001, longitude: -2.95861100000002 }, Coordinate { latitude: 59.2880549999999, longitude: -2.96555599999999 }, Coordinate { latitude: 59.287216, longitude: -2.97194500000001 }, Coordinate { latitude: 59.284721, longitude: -2.97638899999998 }, Coordinate { latitude: 59.281387, longitude: -2.97416699999997 }, Coordinate { latitude: 59.272774, longitude: -2.976944 }, Coordinate { latitude: 59.2641600000001, longitude: -2.98805599999997 }, Coordinate { latitude: 59.2616650000001, longitude: -2.99222200000003 }, Coordinate { latitude: 59.261108, longitude: -2.999167 }, Coordinate { latitude: 59.263611, longitude: -3.003334 }, Coordinate { latitude: 59.284996, longitude: -3.02833399999992 }, Coordinate { latitude: 59.3241650000001, longitude: -3.07361100000003 }, Coordinate { latitude: 59.327499, longitude: -3.07555600000001 }, Coordinate { latitude: 59.3313830000001, longitude: -3.07638900000001 }, Coordinate { latitude: 59.3313830000001, longitude: -3.07166699999993 }, Coordinate { latitude: 59.3291630000001, longitude: -3.04888899999997 }, Coordinate { latitude: 59.2997210000001, longitude: -2.897223 }, Coordinate { latitude: 59.2952730000001, longitude: -2.88999999999999 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 60.4711070000001, longitude: -1.28666700000002 }, Coordinate { latitude: 60.454437, longitude: -1.16388899999993 }, Coordinate { latitude: 60.446938, longitude: -1.04138899999998 }, Coordinate { latitude: 60.4441600000001, longitude: -1.03722199999999 }, Coordinate { latitude: 60.4399950000001, longitude: -1.03777799999995 }, Coordinate { latitude: 60.3580549999999, longitude: -1.06611099999998 }, Coordinate { latitude: 60.275833, longitude: -1.101111 }, Coordinate { latitude: 60.2583310000001, longitude: -1.16416700000002 }, Coordinate { latitude: 60.2619400000001, longitude: -1.16583300000002 }, Coordinate { latitude: 60.2697220000001, longitude: -1.18694399999998 }, Coordinate { latitude: 60.2708280000001, longitude: -1.19499999999994 }, Coordinate { latitude: 60.267776, longitude: -1.19888899999995 }, Coordinate { latitude: 60.2633290000001, longitude: -1.20055600000001 }, Coordinate { latitude: 60.255829, longitude: -1.19805599999995 }, Coordinate { latitude: 60.230553, longitude: -1.18555599999996 }, Coordinate { latitude: 60.2249980000001, longitude: -1.18055599999997 }, Coordinate { latitude: 60.194717, longitude: -1.15750000000003 }, Coordinate { latitude: 60.151665, longitude: -1.12611099999992 }, Coordinate { latitude: 60.1477740000001, longitude: -1.12555600000002 }, Coordinate { latitude: 60.1441650000001, longitude: -1.12861099999992 }, Coordinate { latitude: 60.1319429999999, longitude: -1.14666699999998 }, Coordinate { latitude: 60.1330490000001, longitude: -1.15305599999994 }, Coordinate { latitude: 60.1374970000001, longitude: -1.16305599999993 }, Coordinate { latitude: 60.1372150000001, longitude: -1.17055599999992 }, Coordinate { latitude: 60.1272200000001, longitude: -1.18722199999996 }, Coordinate { latitude: 60.102776, longitude: -1.212222 }, Coordinate { latitude: 60.022499, longitude: -1.22055599999999 }, Coordinate { latitude: 59.862221, longitude: -1.26027799999997 }, Coordinate { latitude: 59.8583300000001, longitude: -1.26249999999999 }, Coordinate { latitude: 59.851105, longitude: -1.26861099999996 }, Coordinate { latitude: 59.8574980000001, longitude: -1.30694499999993 }, Coordinate { latitude: 59.8916630000001, longitude: -1.37194499999998 }, Coordinate { latitude: 59.9022220000001, longitude: -1.37805599999996 }, Coordinate { latitude: 59.9063870000001, longitude: -1.37777799999998 }, Coordinate { latitude: 59.9969410000001, longitude: -1.33166699999998 }, Coordinate { latitude: 60.0000000000001, longitude: -1.33003799999995 }, Coordinate { latitude: 60.0044400000001, longitude: -1.32638900000001 }, Coordinate { latitude: 60.0074999999999, longitude: -1.32249999999999 }, Coordinate { latitude: 60.0088880000001, longitude: -1.31638900000002 }, Coordinate { latitude: 60.0066600000001, longitude: -1.31138900000002 }, Coordinate { latitude: 60.0088880000001, longitude: -1.30805600000002 }, Coordinate { latitude: 60.0127720000001, longitude: -1.30583299999995 }, Coordinate { latitude: 60.0936050000001, longitude: -1.26833299999998 }, Coordinate { latitude: 60.106941, longitude: -1.26305599999995 }, Coordinate { latitude: 60.115829, longitude: -1.26111099999997 }, Coordinate { latitude: 60.124161, longitude: -1.26027799999997 }, Coordinate { latitude: 60.1308289999999, longitude: -1.26166699999999 }, Coordinate { latitude: 60.2199939999999, longitude: -1.28500000000003 }, Coordinate { latitude: 60.241386, longitude: -1.29138899999998 }, Coordinate { latitude: 60.255829, longitude: -1.40333299999992 }, Coordinate { latitude: 60.2549970000001, longitude: -1.41027800000001 }, Coordinate { latitude: 60.2519379999999, longitude: -1.41416699999996 }, Coordinate { latitude: 60.2494430000001, longitude: -1.41027800000001 }, Coordinate { latitude: 60.237221, longitude: -1.38749999999993 }, Coordinate { latitude: 60.2297210000001, longitude: -1.36361099999999 }, Coordinate { latitude: 60.2088850000001, longitude: -1.35305599999992 }, Coordinate { latitude: 60.192497, longitude: -1.35833300000002 }, Coordinate { latitude: 60.1511080000001, longitude: -1.44861099999997 }, Coordinate { latitude: 60.152496, longitude: -1.45361099999997 }, Coordinate { latitude: 60.1677700000001, longitude: -1.49055599999997 }, Coordinate { latitude: 60.181389, longitude: -1.52027800000002 }, Coordinate { latitude: 60.186943, longitude: -1.52722199999999 }, Coordinate { latitude: 60.1908260000001, longitude: -1.52777799999996 }, Coordinate { latitude: 60.1944430000001, longitude: -1.52666699999997 }, Coordinate { latitude: 60.201111, longitude: -1.519722 }, Coordinate { latitude: 60.215828, longitude: -1.58888899999999 }, Coordinate { latitude: 60.224716, longitude: -1.64777799999996 }, Coordinate { latitude: 60.226105, longitude: -1.65499999999997 }, Coordinate { latitude: 60.2308270000001, longitude: -1.66472199999993 }, Coordinate { latitude: 60.239441, longitude: -1.67444499999999 }, Coordinate { latitude: 60.246384, longitude: -1.67805599999997 }, Coordinate { latitude: 60.2797160000001, longitude: -1.69305600000001 }, Coordinate { latitude: 60.283882, longitude: -1.69277799999992 }, Coordinate { latitude: 60.28833, longitude: -1.69138899999996 }, Coordinate { latitude: 60.2997210000001, longitude: -1.666945 }, Coordinate { latitude: 60.3030550000001, longitude: -1.65527799999995 }, Coordinate { latitude: 60.3072200000001, longitude: -1.628334 }, Coordinate { latitude: 60.308052, longitude: -1.59666699999997 }, Coordinate { latitude: 60.3063890000001, longitude: -1.58972199999999 }, Coordinate { latitude: 60.314995, longitude: -1.47472199999993 }, Coordinate { latitude: 60.318604, longitude: -1.44583299999999 }, Coordinate { latitude: 60.3213880000001, longitude: -1.42694399999993 }, Coordinate { latitude: 60.339996, longitude: -1.34583400000002 }, Coordinate { latitude: 60.356384, longitude: -1.32027799999992 }, Coordinate { latitude: 60.4605480000001, longitude: -1.44583299999999 }, Coordinate { latitude: 60.4697190000001, longitude: -1.50222200000002 }, Coordinate { latitude: 60.4755550000001, longitude: -1.55361099999999 }, Coordinate { latitude: 60.4730530000001, longitude: -1.558333 }, Coordinate { latitude: 60.4730530000001, longitude: -1.565 }, Coordinate { latitude: 60.4741590000001, longitude: -1.60972199999998 }, Coordinate { latitude: 60.476662, longitude: -1.61166699999995 }, Coordinate { latitude: 60.4813839999999, longitude: -1.60999999999996 }, Coordinate { latitude: 60.507774, longitude: -1.59305599999999 }, Coordinate { latitude: 60.535828, longitude: -1.54694499999994 }, Coordinate { latitude: 60.6049960000001, longitude: -1.41611099999994 }, Coordinate { latitude: 60.6069410000001, longitude: -1.41055599999999 }, Coordinate { latitude: 60.6366650000001, longitude: -1.30194399999999 }, Coordinate { latitude: 60.6347200000001, longitude: -1.29583299999996 }, Coordinate { latitude: 60.6311040000001, longitude: -1.29416699999996 }, Coordinate { latitude: 60.613327, longitude: -1.28750000000002 }, Coordinate { latitude: 60.491104, longitude: -1.296111 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 60.48555, longitude: -1.10472199999998 }, Coordinate { latitude: 60.4863819999999, longitude: -1.12749999999994 }, Coordinate { latitude: 60.4894410000001, longitude: -1.13999999999999 }, Coordinate { latitude: 60.492493, longitude: -1.14277799999996 }, Coordinate { latitude: 60.5272220000001, longitude: -1.170278 }, Coordinate { latitude: 60.594994, longitude: -1.1825 }, Coordinate { latitude: 60.6027760000001, longitude: -1.18361099999998 }, Coordinate { latitude: 60.623604, longitude: -1.18138899999997 }, Coordinate { latitude: 60.6325000000001, longitude: -1.17944499999999 }, Coordinate { latitude: 60.6366650000001, longitude: -1.17722199999992 }, Coordinate { latitude: 60.7258300000001, longitude: -1.10999999999996 }, Coordinate { latitude: 60.729996, longitude: -1.09861100000001 }, Coordinate { latitude: 60.7313840000001, longitude: -1.09249999999992 }, Coordinate { latitude: 60.7316670000001, longitude: -1.08472199999994 }, Coordinate { latitude: 60.730827, longitude: -1.05694499999998 }, Coordinate { latitude: 60.7247160000001, longitude: -0.996666999999945 }, Coordinate { latitude: 60.719994, longitude: -0.991110999999989 }, Coordinate { latitude: 60.655548, longitude: -0.982500000000016 }, Coordinate { latitude: 60.6513820000001, longitude: -0.982777999999996 }, Coordinate { latitude: 60.5194400000001, longitude: -1.01777800000002 }, Coordinate { latitude: 60.514999, longitude: -1.01916699999992 }, Coordinate { latitude: 60.5030520000001, longitude: -1.02333399999998 }, Coordinate { latitude: 60.498886, longitude: -1.02555599999999 }, Coordinate { latitude: 60.495827, longitude: -1.02944400000001 }, Coordinate { latitude: 0.0, longitude: 0.0 }, Coordinate { latitude: 60.6733320000001, longitude: -0.83499999999998 }, Coordinate { latitude: 60.6744380000001, longitude: -0.93555600000002 }, Coordinate { latitude: 60.6824950000001, longitude: -0.958610999999962 }, Coordinate { latitude: 60.6880490000001, longitude: -0.965555999999935 }, Coordinate { latitude: 60.7113880000001, longitude: -0.959721999999942 }, Coordinate { latitude: 60.7944410000001, longitude: -0.938889000000017 }, Coordinate { latitude: 60.8422160000001, longitude: -0.883055999999954 }, Coordinate { latitude: 60.8444440000001, longitude: -0.878332999999998 }, Coordinate { latitude: 60.840553, longitude: -0.806110999999987 }, Coordinate { latitude: 60.8311080000001, longitude: -0.77277799999996 }, Coordinate { latitude: 60.8288880000001, longitude: -0.767777999999964 }, Coordinate { latitude: 60.817772, longitude: -0.758056000000011 }, Coordinate { latitude: 60.813889, longitude: -0.757222000000013 }, Coordinate { latitude: 60.7933269999999, longitude: -0.763610999999969 }, Coordinate { latitude: 60.6888890000001, longitude: -0.819722000000013 }, Coordinate { latitude: 0.0, longitude: 0.0 }, ];
use firefly_rt::backtrace::Trace; use firefly_rt::function::ErlangResult; use firefly_rt::term::*; use super::badarg; #[export_name = "unicode:characters_to_list/2"] #[allow(improper_ctypes_definitions)] pub extern "C-unwind" fn characters_to_list( _data: OpaqueTerm, encoding: OpaqueTerm, ) -> ErlangResult { let Term::Atom(_encoding) = encoding.into() else { return badarg(Trace::capture()) }; todo!() }
use thiserror::Error; use solana_program::program_error::ProgramError; #[derive(Error, Debug, Copy, Clone)] pub enum LotteryError { /// Invalid instruction #[error("Invalid Instruction")] InvalidInstruction, /// Not Rent Exempt #[error("Not Rent Exempt")] NotRentExempt, /// Ticket Amount Missing #[error("Ticket amount missing")] TicketAmountMissing, /// Expected Amount Mismatch #[error("Expected Amount Mismatch")] ExpectedAmountMismatch, /// Amount Overflow #[error("Amount Overflow")] AmountOverflow, /// Lottery Finished #[error("Lottery Finished")] LotteryFinished, } impl From<LotteryError> for ProgramError { fn from(e: LotteryError) -> Self { ProgramError::Custom(e as u32) } }
pub fn run() { use std::io; loop { println!("Enter temp in F or C (or 'q' to quit)"); let mut input = String::new(); io::stdin() .read_line(&mut input) .expect("Failed to read line"); if "q\n" == input { break; } let input: f64 = if let Ok(n) = input.trim().parse() { n } else { println!("Try a number?"); continue; }; println!( "{}F is {:.1}C, and {0}C is {:.1}F", input, f2c(input), c2f(input) ); } } fn f2c(f: f64) -> f64 { (f - 32.0) / 9.0 * 5.0 } fn c2f(c: f64) -> f64 { c / 5.0 * 9.0 + 32.0 } #[cfg(test)] mod tests { use super::*; #[test] fn freezing() { assert_eq!(f2c(32.0), 0.0); assert_eq!(c2f(0.0), 32.0); } #[test] fn negative_forty() { assert_eq!(f2c(-40.0), -40.0); assert_eq!(c2f(-40.0), -40.0); } #[test] fn boiling() { assert_eq!(f2c(212.0), 100.0); assert_eq!(c2f(100.0), 212.0); } }
use proconio::input; fn main() { input! { n: usize, ab: [(u32, u32); n], }; const M: u64 = 998244353; macro_rules! add { ($a: expr, $b: expr) => { $a = ($a + $b) % M; }; } let mut dp = [1, 1]; for i in 1..n { let (a, b) = ab[i - 1]; let (aa, bb) = ab[i]; let mut next = [0, 0]; if a != aa { add!(next[0], dp[0]); } if a != bb { add!(next[1], dp[0]); } if b != aa { add!(next[0], dp[1]); } if b != bb { add!(next[1], dp[1]); } dp = next; } let ans = (dp[0] + dp[1]) % M; println!("{}", ans); }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct FrameNavigationOptions(pub ::windows::core::IInspectable); impl FrameNavigationOptions { pub fn IsNavigationStackEnabled(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsNavigationStackEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } #[cfg(feature = "UI_Xaml_Media_Animation")] pub fn TransitionInfoOverride(&self) -> ::windows::core::Result<super::Media::Animation::NavigationTransitionInfo> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Media::Animation::NavigationTransitionInfo>(result__) } } #[cfg(feature = "UI_Xaml_Media_Animation")] pub fn SetTransitionInfoOverride<'a, Param0: ::windows::core::IntoParam<'a, super::Media::Animation::NavigationTransitionInfo>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn new() -> ::windows::core::Result<FrameNavigationOptions> { Self::IFrameNavigationOptionsFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), ::core::ptr::null_mut(), &mut ::core::option::Option::<::windows::core::IInspectable>::None as *mut _ as _, &mut result__).from_abi::<FrameNavigationOptions>(result__) }) } pub fn IFrameNavigationOptionsFactory<R, F: FnOnce(&IFrameNavigationOptionsFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<FrameNavigationOptions, IFrameNavigationOptionsFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for FrameNavigationOptions { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.UI.Xaml.Navigation.FrameNavigationOptions;{b539ad2a-9fb7-520a-8f41-57a50c59cf92})"); } unsafe impl ::windows::core::Interface for FrameNavigationOptions { type Vtable = IFrameNavigationOptions_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb539ad2a_9fb7_520a_8f41_57a50c59cf92); } impl ::windows::core::RuntimeName for FrameNavigationOptions { const NAME: &'static str = "Windows.UI.Xaml.Navigation.FrameNavigationOptions"; } impl ::core::convert::From<FrameNavigationOptions> for ::windows::core::IUnknown { fn from(value: FrameNavigationOptions) -> Self { value.0 .0 } } impl ::core::convert::From<&FrameNavigationOptions> for ::windows::core::IUnknown { fn from(value: &FrameNavigationOptions) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for FrameNavigationOptions { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a FrameNavigationOptions { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<FrameNavigationOptions> for ::windows::core::IInspectable { fn from(value: FrameNavigationOptions) -> Self { value.0 } } impl ::core::convert::From<&FrameNavigationOptions> for ::windows::core::IInspectable { fn from(value: &FrameNavigationOptions) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for FrameNavigationOptions { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a FrameNavigationOptions { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for FrameNavigationOptions {} unsafe impl ::core::marker::Sync for FrameNavigationOptions {} #[repr(transparent)] #[doc(hidden)] pub struct IFrameNavigationOptions(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IFrameNavigationOptions { type Vtable = IFrameNavigationOptions_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb539ad2a_9fb7_520a_8f41_57a50c59cf92); } #[repr(C)] #[doc(hidden)] pub struct IFrameNavigationOptions_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Xaml_Media_Animation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Media_Animation"))] usize, #[cfg(feature = "UI_Xaml_Media_Animation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Media_Animation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IFrameNavigationOptionsFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IFrameNavigationOptionsFactory { type Vtable = IFrameNavigationOptionsFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd4681e41_7e6d_5c7c_aca0_478681cc6fce); } #[repr(C)] #[doc(hidden)] pub struct IFrameNavigationOptionsFactory_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, baseinterface: ::windows::core::RawPtr, innerinterface: *mut ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct INavigatingCancelEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for INavigatingCancelEventArgs { type Vtable = INavigatingCancelEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfd1d67ae_eafb_4079_be80_6dc92a03aedf); } #[repr(C)] #[doc(hidden)] pub struct INavigatingCancelEventArgs_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut NavigationMode) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Xaml_Interop")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<super::Interop::TypeName>) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Interop"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct INavigatingCancelEventArgs2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for INavigatingCancelEventArgs2 { type Vtable = INavigatingCancelEventArgs2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5407b704_8147_4343_838f_dd1ee908c137); } #[repr(C)] #[doc(hidden)] pub struct INavigatingCancelEventArgs2_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Xaml_Media_Animation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Media_Animation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct INavigationEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for INavigationEventArgs { type Vtable = INavigationEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb6aa9834_6691_44d1_bdf7_58820c27b0d0); } #[repr(C)] #[doc(hidden)] pub struct INavigationEventArgs_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Xaml_Interop")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<super::Interop::TypeName>) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Interop"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut NavigationMode) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct INavigationEventArgs2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for INavigationEventArgs2 { type Vtable = INavigationEventArgs2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdbff71d9_979a_4b2e_a49b_3bb17fdef574); } #[repr(C)] #[doc(hidden)] pub struct INavigationEventArgs2_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Xaml_Media_Animation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Media_Animation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct INavigationFailedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for INavigationFailedEventArgs { type Vtable = INavigationFailedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x11c1dff7_36c2_4102_b2ef_0217a97289b3); } #[repr(C)] #[doc(hidden)] pub struct INavigationFailedEventArgs_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::HRESULT) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Xaml_Interop")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<super::Interop::TypeName>) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Interop"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IPageStackEntry(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IPageStackEntry { type Vtable = IPageStackEntry_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xef8814a6_9388_4aca_8572_405194069080); } #[repr(C)] #[doc(hidden)] pub struct IPageStackEntry_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Xaml_Interop")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<super::Interop::TypeName>) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Interop"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Xaml_Media_Animation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Xaml_Media_Animation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IPageStackEntryFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IPageStackEntryFactory { type Vtable = IPageStackEntryFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4454048a_a8b9_4f78_9b84_1f51f58851ff); } #[repr(C)] #[doc(hidden)] pub struct IPageStackEntryFactory_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(all(feature = "UI_Xaml_Interop", feature = "UI_Xaml_Media_Animation"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sourcepagetype: ::core::mem::ManuallyDrop<super::Interop::TypeName>, parameter: ::windows::core::RawPtr, navigationtransitioninfo: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "UI_Xaml_Interop", feature = "UI_Xaml_Media_Animation")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IPageStackEntryStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IPageStackEntryStatics { type Vtable = IPageStackEntryStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaceff8e3_246c_4033_9f01_01cb0da5254e); } #[repr(C)] #[doc(hidden)] pub struct IPageStackEntryStatics_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, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct LoadCompletedEventHandler(::windows::core::IUnknown); impl LoadCompletedEventHandler { pub fn new<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static>(invoke: F) -> Self { let com = LoadCompletedEventHandler_box::<F> { vtable: &LoadCompletedEventHandler_box::<F>::VTABLE, count: ::windows::core::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(::windows::core::alloc::boxed::Box::new(com)) } } pub fn Invoke<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::IInspectable>, Param1: ::windows::core::IntoParam<'a, NavigationEventArgs>>(&self, sender: Param0, e: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).3)(::core::mem::transmute_copy(this), sender.into_param().abi(), e.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for LoadCompletedEventHandler { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"delegate({aebaf785-43fc-4e2c-95c3-97ae84eabc8e})"); } unsafe impl ::windows::core::Interface for LoadCompletedEventHandler { type Vtable = LoadCompletedEventHandler_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaebaf785_43fc_4e2c_95c3_97ae84eabc8e); } #[repr(C)] #[doc(hidden)] pub struct LoadCompletedEventHandler_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, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(C)] struct LoadCompletedEventHandler_box<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static> { vtable: *const LoadCompletedEventHandler_abi, invoke: F, count: ::windows::core::RefCount, } impl<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static> LoadCompletedEventHandler_box<F> { const VTABLE: LoadCompletedEventHandler_abi = LoadCompletedEventHandler_abi(Self::QueryInterface, Self::AddRef, Self::Release, Self::Invoke); unsafe extern "system" fn QueryInterface(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; *interface = if iid == &<LoadCompletedEventHandler as ::windows::core::Interface>::IID || iid == &<::windows::core::IUnknown as ::windows::core::Interface>::IID || iid == &<::windows::core::IAgileObject as ::windows::core::Interface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows::core::HRESULT(0x8000_4002) } else { (*this).count.add_ref(); ::windows::core::HRESULT(0) } } unsafe extern "system" fn AddRef(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; (*this).count.add_ref() } unsafe extern "system" fn Release(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { ::windows::core::alloc::boxed::Box::from_raw(this); } remaining } unsafe extern "system" fn Invoke(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; ((*this).invoke)( &*(&sender as *const <::windows::core::IInspectable as ::windows::core::Abi>::Abi as *const <::windows::core::IInspectable as ::windows::core::DefaultType>::DefaultType), &*(&e as *const <NavigationEventArgs as ::windows::core::Abi>::Abi as *const <NavigationEventArgs as ::windows::core::DefaultType>::DefaultType), ) .into() } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NavigatedEventHandler(::windows::core::IUnknown); impl NavigatedEventHandler { pub fn new<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static>(invoke: F) -> Self { let com = NavigatedEventHandler_box::<F> { vtable: &NavigatedEventHandler_box::<F>::VTABLE, count: ::windows::core::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(::windows::core::alloc::boxed::Box::new(com)) } } pub fn Invoke<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::IInspectable>, Param1: ::windows::core::IntoParam<'a, NavigationEventArgs>>(&self, sender: Param0, e: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).3)(::core::mem::transmute_copy(this), sender.into_param().abi(), e.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for NavigatedEventHandler { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"delegate({7bd1cf54-23cf-4cce-b2f5-4ce78d96896e})"); } unsafe impl ::windows::core::Interface for NavigatedEventHandler { type Vtable = NavigatedEventHandler_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7bd1cf54_23cf_4cce_b2f5_4ce78d96896e); } #[repr(C)] #[doc(hidden)] pub struct NavigatedEventHandler_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, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(C)] struct NavigatedEventHandler_box<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static> { vtable: *const NavigatedEventHandler_abi, invoke: F, count: ::windows::core::RefCount, } impl<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static> NavigatedEventHandler_box<F> { const VTABLE: NavigatedEventHandler_abi = NavigatedEventHandler_abi(Self::QueryInterface, Self::AddRef, Self::Release, Self::Invoke); unsafe extern "system" fn QueryInterface(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; *interface = if iid == &<NavigatedEventHandler as ::windows::core::Interface>::IID || iid == &<::windows::core::IUnknown as ::windows::core::Interface>::IID || iid == &<::windows::core::IAgileObject as ::windows::core::Interface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows::core::HRESULT(0x8000_4002) } else { (*this).count.add_ref(); ::windows::core::HRESULT(0) } } unsafe extern "system" fn AddRef(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; (*this).count.add_ref() } unsafe extern "system" fn Release(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { ::windows::core::alloc::boxed::Box::from_raw(this); } remaining } unsafe extern "system" fn Invoke(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; ((*this).invoke)( &*(&sender as *const <::windows::core::IInspectable as ::windows::core::Abi>::Abi as *const <::windows::core::IInspectable as ::windows::core::DefaultType>::DefaultType), &*(&e as *const <NavigationEventArgs as ::windows::core::Abi>::Abi as *const <NavigationEventArgs as ::windows::core::DefaultType>::DefaultType), ) .into() } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NavigatingCancelEventArgs(pub ::windows::core::IInspectable); impl NavigatingCancelEventArgs { pub fn Cancel(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetCancel(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } pub fn NavigationMode(&self) -> ::windows::core::Result<NavigationMode> { let this = self; unsafe { let mut result__: NavigationMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<NavigationMode>(result__) } } #[cfg(feature = "UI_Xaml_Interop")] pub fn SourcePageType(&self) -> ::windows::core::Result<super::Interop::TypeName> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<super::Interop::TypeName> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Interop::TypeName>(result__) } } pub fn Parameter(&self) -> ::windows::core::Result<::windows::core::IInspectable> { let this = &::windows::core::Interface::cast::<INavigatingCancelEventArgs2>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::IInspectable>(result__) } } #[cfg(feature = "UI_Xaml_Media_Animation")] pub fn NavigationTransitionInfo(&self) -> ::windows::core::Result<super::Media::Animation::NavigationTransitionInfo> { let this = &::windows::core::Interface::cast::<INavigatingCancelEventArgs2>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Media::Animation::NavigationTransitionInfo>(result__) } } } unsafe impl ::windows::core::RuntimeType for NavigatingCancelEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.UI.Xaml.Navigation.NavigatingCancelEventArgs;{fd1d67ae-eafb-4079-be80-6dc92a03aedf})"); } unsafe impl ::windows::core::Interface for NavigatingCancelEventArgs { type Vtable = INavigatingCancelEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfd1d67ae_eafb_4079_be80_6dc92a03aedf); } impl ::windows::core::RuntimeName for NavigatingCancelEventArgs { const NAME: &'static str = "Windows.UI.Xaml.Navigation.NavigatingCancelEventArgs"; } impl ::core::convert::From<NavigatingCancelEventArgs> for ::windows::core::IUnknown { fn from(value: NavigatingCancelEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&NavigatingCancelEventArgs> for ::windows::core::IUnknown { fn from(value: &NavigatingCancelEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for NavigatingCancelEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a NavigatingCancelEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<NavigatingCancelEventArgs> for ::windows::core::IInspectable { fn from(value: NavigatingCancelEventArgs) -> Self { value.0 } } impl ::core::convert::From<&NavigatingCancelEventArgs> for ::windows::core::IInspectable { fn from(value: &NavigatingCancelEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for NavigatingCancelEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a NavigatingCancelEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for NavigatingCancelEventArgs {} unsafe impl ::core::marker::Sync for NavigatingCancelEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NavigatingCancelEventHandler(::windows::core::IUnknown); impl NavigatingCancelEventHandler { pub fn new<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigatingCancelEventArgs>) -> ::windows::core::Result<()> + 'static>(invoke: F) -> Self { let com = NavigatingCancelEventHandler_box::<F> { vtable: &NavigatingCancelEventHandler_box::<F>::VTABLE, count: ::windows::core::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(::windows::core::alloc::boxed::Box::new(com)) } } pub fn Invoke<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::IInspectable>, Param1: ::windows::core::IntoParam<'a, NavigatingCancelEventArgs>>(&self, sender: Param0, e: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).3)(::core::mem::transmute_copy(this), sender.into_param().abi(), e.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for NavigatingCancelEventHandler { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"delegate({75d6a78f-a302-4489-9898-24ea49182910})"); } unsafe impl ::windows::core::Interface for NavigatingCancelEventHandler { type Vtable = NavigatingCancelEventHandler_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x75d6a78f_a302_4489_9898_24ea49182910); } #[repr(C)] #[doc(hidden)] pub struct NavigatingCancelEventHandler_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, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(C)] struct NavigatingCancelEventHandler_box<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigatingCancelEventArgs>) -> ::windows::core::Result<()> + 'static> { vtable: *const NavigatingCancelEventHandler_abi, invoke: F, count: ::windows::core::RefCount, } impl<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigatingCancelEventArgs>) -> ::windows::core::Result<()> + 'static> NavigatingCancelEventHandler_box<F> { const VTABLE: NavigatingCancelEventHandler_abi = NavigatingCancelEventHandler_abi(Self::QueryInterface, Self::AddRef, Self::Release, Self::Invoke); unsafe extern "system" fn QueryInterface(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; *interface = if iid == &<NavigatingCancelEventHandler as ::windows::core::Interface>::IID || iid == &<::windows::core::IUnknown as ::windows::core::Interface>::IID || iid == &<::windows::core::IAgileObject as ::windows::core::Interface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows::core::HRESULT(0x8000_4002) } else { (*this).count.add_ref(); ::windows::core::HRESULT(0) } } unsafe extern "system" fn AddRef(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; (*this).count.add_ref() } unsafe extern "system" fn Release(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { ::windows::core::alloc::boxed::Box::from_raw(this); } remaining } unsafe extern "system" fn Invoke(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; ((*this).invoke)( &*(&sender as *const <::windows::core::IInspectable as ::windows::core::Abi>::Abi as *const <::windows::core::IInspectable as ::windows::core::DefaultType>::DefaultType), &*(&e as *const <NavigatingCancelEventArgs as ::windows::core::Abi>::Abi as *const <NavigatingCancelEventArgs as ::windows::core::DefaultType>::DefaultType), ) .into() } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct NavigationCacheMode(pub i32); impl NavigationCacheMode { pub const Disabled: NavigationCacheMode = NavigationCacheMode(0i32); pub const Required: NavigationCacheMode = NavigationCacheMode(1i32); pub const Enabled: NavigationCacheMode = NavigationCacheMode(2i32); } impl ::core::convert::From<i32> for NavigationCacheMode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for NavigationCacheMode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for NavigationCacheMode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.UI.Xaml.Navigation.NavigationCacheMode;i4)"); } impl ::windows::core::DefaultType for NavigationCacheMode { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NavigationEventArgs(pub ::windows::core::IInspectable); impl NavigationEventArgs { pub fn Content(&self) -> ::windows::core::Result<::windows::core::IInspectable> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::IInspectable>(result__) } } pub fn Parameter(&self) -> ::windows::core::Result<::windows::core::IInspectable> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::IInspectable>(result__) } } #[cfg(feature = "UI_Xaml_Interop")] pub fn SourcePageType(&self) -> ::windows::core::Result<super::Interop::TypeName> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<super::Interop::TypeName> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Interop::TypeName>(result__) } } pub fn NavigationMode(&self) -> ::windows::core::Result<NavigationMode> { let this = self; unsafe { let mut result__: NavigationMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<NavigationMode>(result__) } } #[cfg(feature = "Foundation")] pub fn Uri(&self) -> ::windows::core::Result<super::super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "UI_Xaml_Media_Animation")] pub fn NavigationTransitionInfo(&self) -> ::windows::core::Result<super::Media::Animation::NavigationTransitionInfo> { let this = &::windows::core::Interface::cast::<INavigationEventArgs2>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Media::Animation::NavigationTransitionInfo>(result__) } } } unsafe impl ::windows::core::RuntimeType for NavigationEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.UI.Xaml.Navigation.NavigationEventArgs;{b6aa9834-6691-44d1-bdf7-58820c27b0d0})"); } unsafe impl ::windows::core::Interface for NavigationEventArgs { type Vtable = INavigationEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb6aa9834_6691_44d1_bdf7_58820c27b0d0); } impl ::windows::core::RuntimeName for NavigationEventArgs { const NAME: &'static str = "Windows.UI.Xaml.Navigation.NavigationEventArgs"; } impl ::core::convert::From<NavigationEventArgs> for ::windows::core::IUnknown { fn from(value: NavigationEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&NavigationEventArgs> for ::windows::core::IUnknown { fn from(value: &NavigationEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for NavigationEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a NavigationEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<NavigationEventArgs> for ::windows::core::IInspectable { fn from(value: NavigationEventArgs) -> Self { value.0 } } impl ::core::convert::From<&NavigationEventArgs> for ::windows::core::IInspectable { fn from(value: &NavigationEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for NavigationEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a NavigationEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for NavigationEventArgs {} unsafe impl ::core::marker::Sync for NavigationEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NavigationFailedEventArgs(pub ::windows::core::IInspectable); impl NavigationFailedEventArgs { pub fn Exception(&self) -> ::windows::core::Result<::windows::core::HRESULT> { let this = self; unsafe { let mut result__: ::windows::core::HRESULT = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HRESULT>(result__) } } pub fn Handled(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetHandled(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value).ok() } } #[cfg(feature = "UI_Xaml_Interop")] pub fn SourcePageType(&self) -> ::windows::core::Result<super::Interop::TypeName> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<super::Interop::TypeName> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Interop::TypeName>(result__) } } } unsafe impl ::windows::core::RuntimeType for NavigationFailedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.UI.Xaml.Navigation.NavigationFailedEventArgs;{11c1dff7-36c2-4102-b2ef-0217a97289b3})"); } unsafe impl ::windows::core::Interface for NavigationFailedEventArgs { type Vtable = INavigationFailedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x11c1dff7_36c2_4102_b2ef_0217a97289b3); } impl ::windows::core::RuntimeName for NavigationFailedEventArgs { const NAME: &'static str = "Windows.UI.Xaml.Navigation.NavigationFailedEventArgs"; } impl ::core::convert::From<NavigationFailedEventArgs> for ::windows::core::IUnknown { fn from(value: NavigationFailedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&NavigationFailedEventArgs> for ::windows::core::IUnknown { fn from(value: &NavigationFailedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for NavigationFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a NavigationFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<NavigationFailedEventArgs> for ::windows::core::IInspectable { fn from(value: NavigationFailedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&NavigationFailedEventArgs> for ::windows::core::IInspectable { fn from(value: &NavigationFailedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for NavigationFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a NavigationFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for NavigationFailedEventArgs {} unsafe impl ::core::marker::Sync for NavigationFailedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NavigationFailedEventHandler(::windows::core::IUnknown); impl NavigationFailedEventHandler { pub fn new<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationFailedEventArgs>) -> ::windows::core::Result<()> + 'static>(invoke: F) -> Self { let com = NavigationFailedEventHandler_box::<F> { vtable: &NavigationFailedEventHandler_box::<F>::VTABLE, count: ::windows::core::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(::windows::core::alloc::boxed::Box::new(com)) } } pub fn Invoke<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::IInspectable>, Param1: ::windows::core::IntoParam<'a, NavigationFailedEventArgs>>(&self, sender: Param0, e: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).3)(::core::mem::transmute_copy(this), sender.into_param().abi(), e.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for NavigationFailedEventHandler { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"delegate({4dab4671-12b2-43c7-b892-9be2dcd3e88d})"); } unsafe impl ::windows::core::Interface for NavigationFailedEventHandler { type Vtable = NavigationFailedEventHandler_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4dab4671_12b2_43c7_b892_9be2dcd3e88d); } #[repr(C)] #[doc(hidden)] pub struct NavigationFailedEventHandler_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, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(C)] struct NavigationFailedEventHandler_box<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationFailedEventArgs>) -> ::windows::core::Result<()> + 'static> { vtable: *const NavigationFailedEventHandler_abi, invoke: F, count: ::windows::core::RefCount, } impl<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationFailedEventArgs>) -> ::windows::core::Result<()> + 'static> NavigationFailedEventHandler_box<F> { const VTABLE: NavigationFailedEventHandler_abi = NavigationFailedEventHandler_abi(Self::QueryInterface, Self::AddRef, Self::Release, Self::Invoke); unsafe extern "system" fn QueryInterface(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; *interface = if iid == &<NavigationFailedEventHandler as ::windows::core::Interface>::IID || iid == &<::windows::core::IUnknown as ::windows::core::Interface>::IID || iid == &<::windows::core::IAgileObject as ::windows::core::Interface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows::core::HRESULT(0x8000_4002) } else { (*this).count.add_ref(); ::windows::core::HRESULT(0) } } unsafe extern "system" fn AddRef(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; (*this).count.add_ref() } unsafe extern "system" fn Release(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { ::windows::core::alloc::boxed::Box::from_raw(this); } remaining } unsafe extern "system" fn Invoke(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; ((*this).invoke)( &*(&sender as *const <::windows::core::IInspectable as ::windows::core::Abi>::Abi as *const <::windows::core::IInspectable as ::windows::core::DefaultType>::DefaultType), &*(&e as *const <NavigationFailedEventArgs as ::windows::core::Abi>::Abi as *const <NavigationFailedEventArgs as ::windows::core::DefaultType>::DefaultType), ) .into() } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct NavigationMode(pub i32); impl NavigationMode { pub const New: NavigationMode = NavigationMode(0i32); pub const Back: NavigationMode = NavigationMode(1i32); pub const Forward: NavigationMode = NavigationMode(2i32); pub const Refresh: NavigationMode = NavigationMode(3i32); } impl ::core::convert::From<i32> for NavigationMode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for NavigationMode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for NavigationMode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.UI.Xaml.Navigation.NavigationMode;i4)"); } impl ::windows::core::DefaultType for NavigationMode { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NavigationStoppedEventHandler(::windows::core::IUnknown); impl NavigationStoppedEventHandler { pub fn new<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static>(invoke: F) -> Self { let com = NavigationStoppedEventHandler_box::<F> { vtable: &NavigationStoppedEventHandler_box::<F>::VTABLE, count: ::windows::core::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(::windows::core::alloc::boxed::Box::new(com)) } } pub fn Invoke<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::IInspectable>, Param1: ::windows::core::IntoParam<'a, NavigationEventArgs>>(&self, sender: Param0, e: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).3)(::core::mem::transmute_copy(this), sender.into_param().abi(), e.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for NavigationStoppedEventHandler { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"delegate({f0117ddb-12fa-4d8d-8b26-b383d09c2b3c})"); } unsafe impl ::windows::core::Interface for NavigationStoppedEventHandler { type Vtable = NavigationStoppedEventHandler_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf0117ddb_12fa_4d8d_8b26_b383d09c2b3c); } #[repr(C)] #[doc(hidden)] pub struct NavigationStoppedEventHandler_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, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(C)] struct NavigationStoppedEventHandler_box<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static> { vtable: *const NavigationStoppedEventHandler_abi, invoke: F, count: ::windows::core::RefCount, } impl<F: FnMut(&::core::option::Option<::windows::core::IInspectable>, &::core::option::Option<NavigationEventArgs>) -> ::windows::core::Result<()> + 'static> NavigationStoppedEventHandler_box<F> { const VTABLE: NavigationStoppedEventHandler_abi = NavigationStoppedEventHandler_abi(Self::QueryInterface, Self::AddRef, Self::Release, Self::Invoke); unsafe extern "system" fn QueryInterface(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; *interface = if iid == &<NavigationStoppedEventHandler as ::windows::core::Interface>::IID || iid == &<::windows::core::IUnknown as ::windows::core::Interface>::IID || iid == &<::windows::core::IAgileObject as ::windows::core::Interface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows::core::HRESULT(0x8000_4002) } else { (*this).count.add_ref(); ::windows::core::HRESULT(0) } } unsafe extern "system" fn AddRef(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; (*this).count.add_ref() } unsafe extern "system" fn Release(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { ::windows::core::alloc::boxed::Box::from_raw(this); } remaining } unsafe extern "system" fn Invoke(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, e: ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; ((*this).invoke)( &*(&sender as *const <::windows::core::IInspectable as ::windows::core::Abi>::Abi as *const <::windows::core::IInspectable as ::windows::core::DefaultType>::DefaultType), &*(&e as *const <NavigationEventArgs as ::windows::core::Abi>::Abi as *const <NavigationEventArgs as ::windows::core::DefaultType>::DefaultType), ) .into() } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct PageStackEntry(pub ::windows::core::IInspectable); impl PageStackEntry { #[cfg(feature = "UI_Xaml_Interop")] pub fn SourcePageType(&self) -> ::windows::core::Result<super::Interop::TypeName> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<super::Interop::TypeName> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Interop::TypeName>(result__) } } pub fn Parameter(&self) -> ::windows::core::Result<::windows::core::IInspectable> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::IInspectable>(result__) } } #[cfg(feature = "UI_Xaml_Media_Animation")] pub fn NavigationTransitionInfo(&self) -> ::windows::core::Result<super::Media::Animation::NavigationTransitionInfo> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Media::Animation::NavigationTransitionInfo>(result__) } } #[cfg(all(feature = "UI_Xaml_Interop", feature = "UI_Xaml_Media_Animation"))] pub fn CreateInstance<'a, Param0: ::windows::core::IntoParam<'a, super::Interop::TypeName>, Param1: ::windows::core::IntoParam<'a, ::windows::core::IInspectable>, Param2: ::windows::core::IntoParam<'a, super::Media::Animation::NavigationTransitionInfo>>(sourcepagetype: Param0, parameter: Param1, navigationtransitioninfo: Param2) -> ::windows::core::Result<PageStackEntry> { Self::IPageStackEntryFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), sourcepagetype.into_param().abi(), parameter.into_param().abi(), navigationtransitioninfo.into_param().abi(), &mut result__).from_abi::<PageStackEntry>(result__) }) } pub fn SourcePageTypeProperty() -> ::windows::core::Result<super::DependencyProperty> { Self::IPageStackEntryStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::DependencyProperty>(result__) }) } pub fn IPageStackEntryFactory<R, F: FnOnce(&IPageStackEntryFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<PageStackEntry, IPageStackEntryFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IPageStackEntryStatics<R, F: FnOnce(&IPageStackEntryStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<PageStackEntry, IPageStackEntryStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for PageStackEntry { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.UI.Xaml.Navigation.PageStackEntry;{ef8814a6-9388-4aca-8572-405194069080})"); } unsafe impl ::windows::core::Interface for PageStackEntry { type Vtable = IPageStackEntry_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xef8814a6_9388_4aca_8572_405194069080); } impl ::windows::core::RuntimeName for PageStackEntry { const NAME: &'static str = "Windows.UI.Xaml.Navigation.PageStackEntry"; } impl ::core::convert::From<PageStackEntry> for ::windows::core::IUnknown { fn from(value: PageStackEntry) -> Self { value.0 .0 } } impl ::core::convert::From<&PageStackEntry> for ::windows::core::IUnknown { fn from(value: &PageStackEntry) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for PageStackEntry { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a PageStackEntry { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<PageStackEntry> for ::windows::core::IInspectable { fn from(value: PageStackEntry) -> Self { value.0 } } impl ::core::convert::From<&PageStackEntry> for ::windows::core::IInspectable { fn from(value: &PageStackEntry) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for PageStackEntry { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a PageStackEntry { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<PageStackEntry> for super::DependencyObject { fn from(value: PageStackEntry) -> Self { ::core::convert::Into::<super::DependencyObject>::into(&value) } } impl ::core::convert::From<&PageStackEntry> for super::DependencyObject { fn from(value: &PageStackEntry) -> Self { ::windows::core::Interface::cast(value).unwrap() } } impl<'a> ::windows::core::IntoParam<'a, super::DependencyObject> for PageStackEntry { fn into_param(self) -> ::windows::core::Param<'a, super::DependencyObject> { ::windows::core::Param::Owned(::core::convert::Into::<super::DependencyObject>::into(self)) } } impl<'a> ::windows::core::IntoParam<'a, super::DependencyObject> for &PageStackEntry { fn into_param(self) -> ::windows::core::Param<'a, super::DependencyObject> { ::windows::core::Param::Owned(::core::convert::Into::<super::DependencyObject>::into(::core::clone::Clone::clone(self))) } } unsafe impl ::core::marker::Send for PageStackEntry {} unsafe impl ::core::marker::Sync for PageStackEntry {}
use crate::{app::AppContextPointer, gui::control_area::BOX_SPACING}; use gtk::{self, gdk::RGBA, prelude::*, Frame, ScrolledWindow}; use std::rc::Rc; pub fn make_overlay_frame(ac: &AppContextPointer) -> ScrolledWindow { let f = Frame::new(None); //f.set_shadow_type(gtk::ShadowType::None); f.set_hexpand(true); f.set_vexpand(true); // Layout vertically let v_box = gtk::Box::new(gtk::Orientation::Vertical, BOX_SPACING); v_box.set_baseline_position(gtk::BaselinePosition::Top); let skewt_frame = gtk::Frame::new(Some("Skew-T")); let skewt_box = gtk::Box::new(gtk::Orientation::Vertical, BOX_SPACING); skewt_frame.set_child(Some(&skewt_box)); build_config_color!(skewt_box, "Parcel profile", ac, parcel_rgba); build_config_color!( skewt_box, "Inversion mix down profile", ac, inversion_mix_down_rgba ); build_config_color!( skewt_box, "Indexes: Parcel Highlight", ac, parcel_indexes_highlight ); build_config_color!(skewt_box, "CAPE", ac, parcel_positive_rgba); build_config_color!(skewt_box, "CIN", ac, parcel_negative_rgba); build_config_color!(skewt_box, "Downburst Profile", ac, downburst_rgba); build_config_color!(skewt_box, "DCAPE", ac, dcape_area_color); build_config_color!(skewt_box, "Effective Inflow Layer", ac, inflow_layer_rgba); build_config_color!(skewt_box, "PFT - SP Curve", ac, pft_sp_curve_color); build_config_color!( skewt_box, "PFT - Mean Specific Humidity", ac, pft_mean_q_color ); build_config_color!( skewt_box, "PFT - Mean Potential Temperature", ac, pft_mean_theta_color ); build_config_color!(skewt_box, "PFT - Cloud Parcel", ac, pft_cloud_parcel_color); let hodo_frame = gtk::Frame::new(Some("Hodograph")); let hodo_box = gtk::Box::new(gtk::Orientation::Vertical, BOX_SPACING); hodo_frame.set_child(Some(&hodo_box)); build_config_color!(hodo_box, "Storm Motion (hodo)", ac, storm_motion_rgba); build_config_color!(hodo_box, "Helicity area color (hodo)", ac, helicity_rgba); // Layout boxes in the frame f.set_child(Some(&v_box)); v_box.append(&skewt_frame); v_box.append(&hodo_frame); let sw = ScrolledWindow::new(); sw.set_child(Some(&f)); sw }
//! Modules for compiling Piccolo source code. pub mod ast; pub mod emitter; pub mod parser; pub mod scanner; use crate::runtime::{Line, LocalScopeDepth}; use crate::{ErrorKind, PiccoloError}; use core::fmt; #[derive(PartialEq)] pub(crate) struct Local { pub(crate) name: String, pub(crate) depth: LocalScopeDepth, } impl Local { pub(crate) fn new(name: String, depth: LocalScopeDepth) -> Self { Self { name, depth } } } #[cfg(feature = "pc-debug")] pub fn compile_chunk(src: &str) -> Result<crate::Chunk, Vec<PiccoloError>> { let mut scanner = super::Scanner::new(src); let ast = parser::parse(&mut scanner)?; let mut emitter = emitter::Emitter::new(); emitter::compile_ast(&mut emitter, &ast)?; Ok(emitter.into_chunk()) } #[cfg(feature = "pc-debug")] pub fn scan_all(source: &str) -> Result<Vec<Token>, PiccoloError> { scanner::Scanner::new(source).scan_all() } pub(crate) fn escape_string(t: &Token) -> Result<String, PiccoloError> { match t.kind { TokenKind::String => { let s = t.lexeme; let mut value = Vec::new(); let line_start = t.line; let mut line = line_start; let mut i = 1; while i < s.as_bytes().len() - 1 { let byte = s.as_bytes()[i]; if byte == b'\n' { line += 1; } if byte == b'\\' { i += 1; let byte = s.as_bytes()[i]; match byte { b'n' => { value.push(b'\n'); } b'r' => { value.push(b'\r'); } b'\\' => { value.push(b'\\'); } b'"' => { value.push(b'"'); } b't' => { value.push(b'\t'); } b'\r' | b'\n' => { while i < s.as_bytes().len() - 1 && scanner::is_whitespace(s.as_bytes()[i]) { i += 1; } i -= 1; } c => { return Err(PiccoloError::new(ErrorKind::UnknownFormatCode { code: c as char, }) .line(line)); } } } else { value.push(byte); } i += 1; } Ok(String::from_utf8(value)?) } _ => { panic!("Cannot escape string from token {:?}", t); } } } /// Kinds of tokens that may exist in Piccolo code. /// /// Some of these don't currently have a use, and only exist for the creation of /// syntax errors :^) #[derive(Debug, PartialEq, Clone, Copy)] pub enum TokenKind { // keywords Do, // do End, // end Fn, // fn If, // if Else, // else While, // while For, // for In, // in Data, // data Let, // let Is, // is Me, // me New, // new Err, // err Break, // break Continue, // continue Retn, // retn Assert, // nil Nil, // nil // syntax LeftBracket, // [ RightBracket, // ] LeftParen, // ( RightParen, // ) Comma, // , Period, // . ExclusiveRange, // .. InclusiveRange, // ... Assign, // = Declare, // =: // misc. non-tokens LeftBrace, RightBrace, Dollar, At, Grave, Tilde, Colon, Semicolon, Backslash, Question, SingleQuote, // operators Not, // ! Plus, // + Minus, // - Multiply, // * Divide, // / Modulo, // % LogicalAnd, // && LogicalOr, // || BitwiseAnd, // & BitwiseOr, // | BitwiseXor, // ^ Equal, // == NotEqual, // != Less, // < Greater, // > LessEqual, // <= GreaterEqual, // >= ShiftLeft, // << ShiftRight, // >> PlusAssign, // += MinusAssign, // -= DivideAssign, // /= MultiplyAssign, // *= ModuloAssign, // %= BitwiseAndAssign, // &= BitwiseOrAssign, // |= BitwiseXorAssign, // ^= ShiftLeftAssign, // <<= ShiftRightAssign, // >>= // other syntax elements Identifier, String, True, False, Double(f64), Integer(i64), Eof, } /// Represents a token in source code. /// /// Maintains a reference to the original source. #[derive(Debug, Clone, Copy, PartialEq)] pub struct Token<'a> { pub(crate) kind: TokenKind, pub(crate) lexeme: &'a str, pub(crate) line: Line, } impl<'a> Token<'a> { pub fn new(kind: TokenKind, lexeme: &'a str, line: Line) -> Self { Token { kind, lexeme, line } } /// Whether or not the token is a value literal. pub fn is_value(&self) -> bool { matches!( self.kind, TokenKind::Nil | TokenKind::String | TokenKind::True | TokenKind::False | TokenKind::Double(_) | TokenKind::Integer(_) ) } pub fn is_assign(&self) -> bool { matches!( self.kind, TokenKind::Assign | TokenKind::PlusAssign | TokenKind::MinusAssign | TokenKind::DivideAssign | TokenKind::MultiplyAssign | TokenKind::ModuloAssign | TokenKind::BitwiseAndAssign | TokenKind::BitwiseOrAssign | TokenKind::BitwiseXorAssign | TokenKind::ShiftLeftAssign | TokenKind::ShiftRightAssign ) } pub fn assign_by_mutate_op(&self) -> Option<crate::runtime::op::Opcode> { use crate::runtime::op::Opcode; Some(match self.kind { TokenKind::PlusAssign => Opcode::Add, TokenKind::MinusAssign => Opcode::Subtract, TokenKind::DivideAssign => Opcode::Divide, TokenKind::MultiplyAssign => Opcode::Multiply, TokenKind::ModuloAssign => Opcode::Modulo, TokenKind::BitwiseAndAssign => Opcode::BitAnd, TokenKind::BitwiseOrAssign => Opcode::BitOr, TokenKind::BitwiseXorAssign => Opcode::BitXor, TokenKind::ShiftLeftAssign => Opcode::ShiftLeft, TokenKind::ShiftRightAssign => Opcode::ShiftRight, _ => None?, }) } } impl<'a> fmt::Display for Token<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match &self.kind { TokenKind::Identifier => write!(f, "{}", self.lexeme), TokenKind::String => write!(f, "{}", self.lexeme), TokenKind::Double(v) => write!(f, "{}", v), TokenKind::Integer(v) => write!(f, "{}", v), v => write!(f, "{:?}", v), } } } #[cfg(feature = "fuzzer")] pub fn print_tokens(tokens: &[Token]) { let mut previous_line = 0; for token in tokens.iter() { println!( "{} {:?}{}", if token.line != previous_line { previous_line = token.line; format!("{:>4}", token.line) } else { " |".into() }, token.kind, if token.kind == TokenKind::Identifier { format!(" {}", token.lexeme) } else { "".into() } ); } } #[cfg(feature = "fuzzer")] impl fmt::Display for TokenKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { TokenKind::Do => write!(f, "do"), TokenKind::End => write!(f, "end"), TokenKind::Fn => write!(f, "fn"), TokenKind::If => write!(f, "if"), TokenKind::Else => write!(f, "else"), TokenKind::While => write!(f, "while"), TokenKind::For => write!(f, "for"), TokenKind::In => write!(f, "in"), TokenKind::Data => write!(f, "data"), TokenKind::Let => write!(f, "let"), TokenKind::Is => write!(f, "is"), TokenKind::Me => write!(f, "me"), TokenKind::New => write!(f, "new"), TokenKind::Err => write!(f, "err"), TokenKind::Break => write!(f, "break"), TokenKind::Continue => write!(f, "continue"), TokenKind::Retn => write!(f, "retn"), TokenKind::Assert => write!(f, "assert"), TokenKind::Nil => write!(f, "nil"), TokenKind::LeftBracket => write!(f, "["), TokenKind::RightBracket => write!(f, "]"), TokenKind::LeftParen => write!(f, "("), TokenKind::RightParen => write!(f, ")"), TokenKind::Comma => write!(f, ","), TokenKind::Period => write!(f, "."), TokenKind::ExclusiveRange => write!(f, ".."), TokenKind::InclusiveRange => write!(f, "..."), TokenKind::Assign => write!(f, "="), TokenKind::Declare => write!(f, "=:"), TokenKind::LeftBrace => write!(f, "{{"), TokenKind::RightBrace => write!(f, "}}"), TokenKind::Dollar => write!(f, "$"), TokenKind::At => write!(f, "@"), TokenKind::Grave => write!(f, "`"), TokenKind::Tilde => write!(f, "~"), TokenKind::Colon => write!(f, ":"), TokenKind::Semicolon => write!(f, ";"), TokenKind::Backslash => write!(f, "\\"), TokenKind::Question => write!(f, "?"), TokenKind::SingleQuote => write!(f, "'"), TokenKind::Not => write!(f, "!"), TokenKind::Plus => write!(f, "+"), TokenKind::Minus => write!(f, "-"), TokenKind::Multiply => write!(f, "*"), TokenKind::Divide => write!(f, "/"), TokenKind::Modulo => write!(f, "%"), TokenKind::LogicalAnd => write!(f, "&&"), TokenKind::LogicalOr => write!(f, "||"), TokenKind::BitwiseAnd => write!(f, "&"), TokenKind::BitwiseOr => write!(f, "|"), TokenKind::BitwiseXor => write!(f, "^"), TokenKind::Equal => write!(f, "=="), TokenKind::NotEqual => write!(f, "!="), TokenKind::Less => write!(f, "<"), TokenKind::Greater => write!(f, ">"), TokenKind::LessEqual => write!(f, "<="), TokenKind::GreaterEqual => write!(f, ">="), TokenKind::ShiftLeft => write!(f, "<<"), TokenKind::ShiftRight => write!(f, ">>"), TokenKind::PlusAssign => write!(f, "+="), TokenKind::MinusAssign => write!(f, "-="), TokenKind::DivideAssign => write!(f, "/="), TokenKind::MultiplyAssign => write!(f, "*="), TokenKind::ModuloAssign => write!(f, "%="), TokenKind::BitwiseAndAssign => write!(f, "&="), TokenKind::BitwiseOrAssign => write!(f, "|="), TokenKind::BitwiseXorAssign => write!(f, "^="), TokenKind::ShiftLeftAssign => write!(f, "<<="), TokenKind::ShiftRightAssign => write!(f, ">>="), TokenKind::Identifier => write!(f, "ident"), TokenKind::String => write!(f, "\"str\""), TokenKind::True => write!(f, "true"), TokenKind::False => write!(f, "false"), TokenKind::Double(v) => write!(f, "{}", v), TokenKind::Integer(v) => write!(f, "{}", v), TokenKind::Eof => write!(f, ""), } } }
use criterion::{Criterion, black_box}; use criterion::{criterion_group, criterion_main}; use roots::roots; fn criterion_bench(c: &mut Criterion) { c.bench_function("roots 1", |b| b.iter(|| roots(black_box(&[3.2, 2.0, 1.0])))); } criterion_group!(benches, criterion_bench); criterion_main!(benches);
use crate::io::BufMut; use crate::postgres::protocol::{StatementId, Write}; use byteorder::{ByteOrder, NetworkEndian}; pub struct Parse<'a> { pub statement: StatementId, pub query: &'a str, pub param_types: &'a [u32], } impl Write for Parse<'_> { fn write(&self, buf: &mut Vec<u8>) { buf.push(b'P'); let pos = buf.len(); buf.put_i32::<NetworkEndian>(0); // skip over len self.statement.write(buf); buf.put_str_nul(self.query); buf.put_i16::<NetworkEndian>(self.param_types.len() as i16); for &type_ in self.param_types { buf.put_u32::<NetworkEndian>(type_); } // Write-back the len to the beginning of this frame let len = buf.len() - pos; NetworkEndian::write_i32(&mut buf[pos..], len as i32); } }
use core::u64; #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn fmod(x: f64, y: f64) -> f64 { let mut uxi = x.to_bits(); let mut uyi = y.to_bits(); let mut ex = (uxi >> 52 & 0x7ff) as i64; let mut ey = (uyi >> 52 & 0x7ff) as i64; let sx = uxi >> 63; let mut i; if uyi << 1 == 0 || y.is_nan() || ex == 0x7ff { return (x * y) / (x * y); } if uxi << 1 <= uyi << 1 { if uxi << 1 == uyi << 1 { return 0.0 * x; } return x; } /* normalize x and y */ if ex == 0 { i = uxi << 12; while i >> 63 == 0 { ex -= 1; i <<= 1; } uxi <<= -ex + 1; } else { uxi &= u64::MAX >> 12; uxi |= 1 << 52; } if ey == 0 { i = uyi << 12; while i >> 63 == 0 { ey -= 1; i <<= 1; } uyi <<= -ey + 1; } else { uyi &= u64::MAX >> 12; uyi |= 1 << 52; } /* x mod y */ while ex > ey { i = uxi.wrapping_sub(uyi); if i >> 63 == 0 { if i == 0 { return 0.0 * x; } uxi = i; } uxi <<= 1; ex -= 1; } i = uxi.wrapping_sub(uyi); if i >> 63 == 0 { if i == 0 { return 0.0 * x; } uxi = i; } while uxi >> 52 == 0 { uxi <<= 1; ex -= 1; } /* scale result */ if ex > 0 { uxi -= 1 << 52; uxi |= (ex as u64) << 52; } else { uxi >>= -ex + 1; } uxi |= (sx as u64) << 63; f64::from_bits(uxi) }
use proconio::{input, marker::Usize1}; use lowest_common_ancestor::LowestCommonAncestor; fn main() { input! { n: usize, s: Usize1, t: Usize1, edges: [(Usize1, Usize1); n - 1], }; let lca = LowestCommonAncestor::new(n, s, &edges); for j in 0..n { let v = lca.get(j, t); println!("{}", lca.get_dist(j, v) + 1); } }
extern crate log; extern crate rand; use rand::Rng; use std::cmp; use std::fmt; use std::collections; pub mod stone; pub use self::stone::Stone; pub mod vertex; pub use self::vertex::Vertex; pub use self::vertex::PASS; pub mod constants; pub use self::constants::NEIGHBOURS; pub use self::constants::DIAG_NEIGHBOURS; pub mod string; pub use self::string::String; // Maximum supported board size (width/height). const MAX_SIZE: u8 = 19; // Size of the virtual board necessary to support a board of MAX_SIZE. // This includes a one stone border on all sides of the board. pub const VIRT_SIZE: u8 = MAX_SIZE + 2; // Length of an array/vector necessary to store the virtual board. pub const VIRT_LEN: usize = VIRT_SIZE as usize * VIRT_SIZE as usize; #[derive(Clone)] pub struct GoGame { pub size: usize, // Board of stones with a 1-stone border on all sides to remove the need for // bound checking. Laid out as 1D vector, see GoGame::vertex for index // calculation. board: Vec<Stone>, strings: Vec<String>, // Head of the string for every vertex of the board. string_head: Vec<Vertex>, // Implicit representation of the linked list of all stones belonging to the // same String. Cyclic, indexed by Vertex. string_next_v: Vec<Vertex>, // Vector of all empty vertices. empty_vertices: Vec<Vertex>, // Position of every vertex in the vector above, to allow constant time // removal and addition. empty_v_index: Vec<usize>, // Number of black stones on the board, for scoring at the end of the game. // WHITE stones can be deduced from this, board size and empty_vertices. num_black_stones: i16, // Vertex that can't be played on because it would be simple ko. ko_vertex: Vertex, pub to_play: Stone, pub history: Vec<(Stone, Vertex)>, } impl GoGame { pub fn new(size: usize) -> GoGame { if size as u8 > MAX_SIZE { panic!("{} is larger than maximum supported board size of {}", size, MAX_SIZE); } let mut game = GoGame { size: size, board: vec![stone::BORDER; VIRT_LEN], strings: vec![String::new(); VIRT_LEN], string_head: vec![PASS; VIRT_LEN], string_next_v: vec![PASS; VIRT_LEN], empty_vertices: Vec::with_capacity(size * size), empty_v_index: vec![0; VIRT_LEN], num_black_stones: 0, ko_vertex: PASS, to_play: stone::BLACK, history: Vec::with_capacity(600), }; game.reset(); game } // Resets the game and clears the board. Same result as creating a new // instance, but this doesn't need to allocate any memory. pub fn reset(&mut self) { self.empty_vertices.clear(); self.num_black_stones = 0; self.ko_vertex = PASS; self.to_play = stone::BLACK; self.history.clear(); for i in 0 .. (VIRT_LEN) as usize { self.strings[i].reset_border(); self.string_head[i] = Vertex(i as i16); self.string_next_v[i] = PASS; } for col in 0 .. self.size { for row in 0 .. self.size { let v = GoGame::vertex(row as i16, col as i16); self.board[v.as_index()] = stone::EMPTY; self.strings[v.as_index()].reset(); self.empty_v_index[v.as_index()] = self.empty_vertices.len(); self.empty_vertices.push(v); } } for col in 0 .. self.size { for row in 0 .. self.size { let v = Vertex::new(row as i16, col as i16); for n in NEIGHBOURS[v.as_index()].iter() { if self.stone_at(*n) == stone::EMPTY { self.strings[v.as_index()].add_liberty(*n); } } } } } pub fn vertex(x: i16, y: i16) -> Vertex { Vertex::new(x, y) } fn set_stone(&mut self, stone: Stone, vertex: Vertex) { let old_stone = self.board[vertex.as_index()]; // Place new stone.. self.board[vertex.as_index()] = stone; // Update empty vertex list. if stone == stone::EMPTY { self.empty_v_index[vertex.as_index()] = self.empty_vertices.len(); self.empty_vertices.push(vertex); } else { if old_stone != stone::EMPTY { println!("not empty!"); } let i = self.empty_v_index[vertex.as_index()]; { let last = self.empty_vertices.last().unwrap(); self.empty_v_index[last.as_index()] = i; } self.empty_vertices.swap_remove(i); } // Update stone count for scoring. if old_stone == stone::BLACK { self.num_black_stones -= 1; } else if stone == stone::BLACK { self.num_black_stones += 1; } } pub fn play(&mut self, stone: Stone, vertex: Vertex) -> bool { if cfg!(debug) && !self.can_play(stone, vertex) { return false; } self.to_play = stone.opponent(); self.history.push((stone, vertex)); if vertex == PASS { return true; } // Preparation for ko checking. let old_num_empty_vertices = self.empty_vertices.len(); let mut played_in_enemy_eye = true; for n in NEIGHBOURS[vertex.as_index()].iter() { let s = self.stone_at(*n); if s == stone || s == stone::EMPTY { played_in_enemy_eye = false; } } self.ko_vertex = PASS; self.join_groups_around(vertex, stone); self.set_stone(stone, vertex); self.remove_liberty_from_neighbouring_groups(vertex); self.capture_dead_groups(vertex, stone); if played_in_enemy_eye && old_num_empty_vertices == self.empty_vertices.len() { self.ko_vertex = *self.empty_vertices.last().unwrap(); } return true; } pub fn undo(&mut self, num_moves: usize) -> bool { if num_moves > self.history.len() { return false; } let history = self.history.clone(); self.reset(); // println!("{:?}", self); for i in 0 .. (history.len() - num_moves) { // println!("replaying {:} {:}", history[i].0, history[i].1); self.play(history[i].0, history[i].1); } return true; } fn remove_liberty_from_neighbouring_groups(&mut self, vertex: Vertex) { for n in NEIGHBOURS[vertex.as_index()].iter() { self.strings[self.string_head[n.as_index()].as_index()].remove_liberty(vertex); } } fn capture_dead_groups(&mut self, vertex: Vertex, stone: Stone) { for n in NEIGHBOURS[vertex.as_index()].iter() { if self.stone_at(*n) == stone.opponent() && self.dead(*n) { self.remove_group(*n); } } } fn string(&self, vertex: Vertex) -> &String { return &self.strings[self.string_head[vertex.as_index()].as_index()]; } fn num_pseudo_liberties(&self, vertex: Vertex) -> u8 { return self.string(vertex).num_pseudo_liberties; } // Combines the groups around the newly placed stone at vertex. If no groups // are available for joining, the new stone is placed as it's one new group. fn join_groups_around(&mut self, vertex: Vertex, stone: Stone) { let mut largest_group_head = PASS; let mut largest_group_size = 0; for n in NEIGHBOURS[vertex.as_index()].iter() { if self.stone_at(*n) == stone { let string = self.string(*n); if string.num_stones > largest_group_size { largest_group_size = string.num_stones; largest_group_head = self.string_head[n.as_index()]; } } } if largest_group_size == 0 { self.init_new_string(vertex); return; } for n in NEIGHBOURS[vertex.as_index()].iter() { if self.stone_at(*n) == stone { let string_head = self.string_head[n.as_index()]; if string_head != largest_group_head { // Set all the stones in the smaller string to be part of the larger // string. let mut cur = *n; loop { self.string_head[cur.as_index()] = largest_group_head; cur = self.string_next_v[cur.as_index()]; if cur == *n { break; } } // Connect the two linked lists representing the stones in the two // strings. let tmp = self.string_next_v[largest_group_head.as_index()]; self.string_next_v[largest_group_head.as_index()] = self.string_next_v[n.as_index()]; self.string_next_v[n.as_index()] = tmp; let (small, large) = (string_head.as_index(), largest_group_head.as_index()); if small < large { let (left, right) = self.strings.split_at_mut(large); right[0].merge(&left[small]); } else { let (left, right) = self.strings.split_at_mut(small); left[large].merge(&right[0]); } } } } self.string_next_v[vertex.as_index()] = self.string_next_v[largest_group_head.as_index()]; self.string_next_v[largest_group_head.as_index()] = vertex; self.strings[largest_group_head.as_index()].num_stones += 1; self.string_head[vertex.as_index()] = largest_group_head; for n in NEIGHBOURS[vertex.as_index()].iter() { if self.stone_at(*n) == stone::EMPTY { self.strings[largest_group_head.as_index()].add_liberty(*n); } } } fn init_new_string(&mut self, vertex: Vertex) { self.strings[vertex.as_index()].reset(); self.strings[vertex.as_index()].num_stones += 1; for n in NEIGHBOURS[vertex.as_index()].iter() { if self.stone_at(*n) == stone::EMPTY { self.strings[vertex.as_index()].add_liberty(*n); } } self.string_head[vertex.as_index()] = vertex; self.string_next_v[vertex.as_index()] = vertex; } fn dead(&self, vertex: Vertex) -> bool { return self.string(vertex).num_pseudo_liberties == 0; } fn remove_group(&mut self, vertex: Vertex) { let mut cur = vertex; let string_head = self.string_head[vertex.as_index()]; loop { self.set_stone(stone::EMPTY, cur); let next = self.string_next_v[cur.as_index()]; self.init_new_string(cur); for n in NEIGHBOURS[cur.as_index()].iter() { let neighbour_string_head = self.string_head[n.as_index()]; if neighbour_string_head != string_head || self.stone_at(*n) == stone::EMPTY { self.strings[neighbour_string_head.as_index()].add_liberty(cur); } } cur = next; if cur == vertex { break; } } } pub fn stone_at(&self, vertex: Vertex) -> Stone { return self.board[vertex.as_index()] } pub fn can_play(&self, stone: Stone, vertex: Vertex) -> bool { if vertex == PASS { return true; } // Can't play if the vertex is not empty or would be ko. if self.stone_at(vertex) != stone::EMPTY || vertex == self.ko_vertex { return false; } // Can definitely play if the placed stone will have at least one direct // freedom (can't be ko). if self.string(vertex).num_pseudo_liberties > 0 { return true; } // For all checks below, the newly placed stone is completely surrounded by // enemy and friendly stones. // Don't allow to destroy eye-like points. let mut surrounded_by_own = true; let opponent = stone.opponent(); for n in NEIGHBOURS[vertex.as_index()].iter() { let s = self.stone_at(*n); if s == opponent || s == stone::EMPTY { surrounded_by_own = false; break; } } if surrounded_by_own { let mut enemy_count = 0; let mut border = 0; for n in DIAG_NEIGHBOURS[vertex.as_index()].iter() { let s = self.stone_at(*n); if s == opponent { enemy_count += 1; } else if s == stone::BORDER { border = 1; } } if enemy_count + border < 2 { // eye-like point return false; } } // Allow to play if the placed stones connects to a group that still has at // least one other liberty after connecting. for n in NEIGHBOURS[vertex.as_index()].iter() { if self.stone_at(*n) == stone && !self.string(*n).in_atari() { return true; } } // Allow to play if the placed stone will kill at least one group. for n in NEIGHBOURS[vertex.as_index()].iter() { if self.stone_at(*n) == stone.opponent() && self.string(*n).in_atari() { return true; } } // Don't allow to play if the stone would be dead or kill its own group. return false; } pub fn random_move(&self, stone: Stone, rng: &mut rand::StdRng) -> Vertex { let num_empty = self.empty_vertices.len(); if num_empty == 0 { return PASS; } let start_vertex = rng.gen_range(0, num_empty); let mut i = start_vertex; loop { let v = self.empty_vertices[i]; if self.can_play(stone, v) { return v; } i += 1; if i == num_empty { i = 0; } if i == start_vertex { return PASS; } } } pub fn possible_moves(&self, stone: Stone) -> Vec<Vertex> { return self.empty_vertices.iter().map(|v| v.clone()) .filter(|v| self.can_play(stone, *v)).collect::<Vec<_>>(); } pub fn chinese_score(&self) -> i16 { let num_white_stones = (self.size * self.size) as i16 - self.num_black_stones - self.empty_vertices.len() as i16; let mut eye_score = 0; for v in self.empty_vertices.iter() { let mut num_black = 0; let mut num_white = 0; for n in NEIGHBOURS[v.as_index()].iter() { let s = self.stone_at(*n); if s == stone::BLACK { num_black += 1; } else if s == stone::WHITE { num_white += 1; } else { num_black += 1; num_white += 1; } } if num_black == 4 { eye_score += 1; } else if num_white == 4 { eye_score -= 1; } } return self.num_black_stones - num_white_stones + eye_score; } } impl fmt::Display for GoGame { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { let column_labels = "ABCDEFGHJKLMNOPORST"; try!(write!(f, "\x1b[0;37m ")); for col in 0 .. self.size { try!(write!(f, " {}", column_labels.chars().nth(col).unwrap())); } try!(write!(f, "\n")); for row in 0 .. self.size { try!(write!(f, " {:2} \x1b[43m\x1b[1;37m ", row + 1)); for col in 0 .. self.size { try!(match self.stone_at(GoGame::vertex(col as i16, row as i16)) { stone::BLACK => write!(f, "\x1b[30m\u{25CF}\x1b[37m "), stone::WHITE => write!(f, "\u{25CF} "), _ => write!(f, "\u{00b7} ") }); } try!(write!(f, "\x1b[0;37m {:2}\n", row + 1)); } try!(write!(f, " ")); for col in 0 .. self.size { try!(write!(f, " {}", column_labels.chars().nth(col).unwrap())); } return write!(f, ""); } } impl fmt::Debug for GoGame { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { let column_labels = "ABCDEFGHJKLMNOPORST"; try!(write!(f, " ")); for col in 0 .. self.size { try!(write!(f, "{}", column_labels.chars().nth(col).unwrap())); } try!(write!(f, "\n")); let mut row = self.size - 1; loop { try!(write!(f, " {:2} ", row + 1)); for col in 0 .. self.size { try!(match self.stone_at(GoGame::vertex(col as i16, row as i16)) { stone::BLACK => write!(f, "#"), stone::WHITE => write!(f, "O"), _ => write!(f, " ") }); } try!(write!(f, " {:2}\n", row + 1)); if row == 0 { break; } row -= 1; } try!(write!(f, " ")); for col in 0 .. self.size { try!(write!(f, "{}", column_labels.chars().nth(col).unwrap())); } return write!(f, ""); } } impl cmp::PartialEq for GoGame { fn eq(&self, other: &GoGame) -> bool { if self.size != other.size { return false; } if self.ko_vertex != other.ko_vertex { return false; } for col in 0 .. self.size { for row in 0 .. self.size { let v = Vertex::new(row as i16, col as i16); if self.stone_at(v) != other.stone_at(v) { return false; } } } return true; } } #[cfg(test)] mod test;
pub mod footer; pub mod icons; pub mod layout; pub mod navbar; pub mod post; pub mod toggle_theme;
use mode::*; use mode_map::MapErr; use op::PendingOp; use state::State; use typeahead::Parse; use disambiguation_map::Match; impl<K> PendingMode<K> where K: Ord, K: Copy, K: Parse, { fn next_mode(&self) -> Mode<K> { match self.next_mode { NextMode::Insert => insert(), NextMode::Normal => normal(), } } } impl<K> Transition<K> for PendingMode<K> where K: Ord, K: Copy, K: Parse, { fn name(&self) -> &'static str { "Pending" } fn transition(&self, state: &mut State<K>) -> Mode<K> { match state.pending_mode_map.process(&mut state.typeahead) { Err(MapErr::NoMatch) => { // In vim, if one remaps a numeric, e.g. // nnoremap 123 iasdf<Esc> // and proceeds to type 1234, the remap does not wait for // a disambiguating keystroke before completing the remap. // By putting parse_decimal() here instead of in // ModeMap::process(), we mimic this behavior. match state.typeahead.parse_decimal() { Match::FullMatch(n) => { // Update count and stay in same mode. state.count *= n; return self.transition(state); } Match::PartialMatch => { return recast_pending(self); } Match::NoMatch => { // In Pending mode, unmatched typeahead gets dropped. state.typeahead.clear(); } }; } Err(MapErr::InfiniteRecursion) => { // TODO Tell the user they've created an infinite remap loop. state.typeahead.clear(); } Ok(op) => { match op { PendingOp::Cancel => { // TODO drop back to normal mode; clear count. } PendingOp::Operator(o) => { // TODO Perform operation over [motion]. return self.next_mode(); } PendingOp::Motion(m) => { // TODO Perform operation over [motion]. return self.next_mode(); } PendingOp::Object(o) => { // TODO Perform operation over [object]. return self.next_mode(); } } } }; // Go back to whence you came. self.next_mode() } }
pub use paint::{ Canvas, Layer, Projection, Color, Size }; pub mod paint;
use enumflags2::BitFlags; use crate::interrupts::Interrupt; #[derive(BitFlags, Copy, Clone, Debug)] #[repr(u8)] pub enum ButtonKey { A = 1 << 0, B = 1 << 1, Select = 1 << 2, Start = 1 << 3, } #[derive(BitFlags, Copy, Clone, Debug)] #[repr(u8)] pub enum DirKey { Right = 1 << 0, Left = 1 << 1, Up = 1 << 2, Down = 1 << 3, } #[derive(Clone, Debug)] pub struct Joypad { /// Whether the joypad register should reflect which button keys are pressed. select_button_keys: bool, /// Whether the joypad register should reflect which direction keys are pressed. select_dir_keys: bool, /// Bit flags of which button keys are currently held down. button_keys_pressed: BitFlags<ButtonKey>, /// Bit flags of which direction keys are currently held down. dir_keys_pressed: BitFlags<DirKey>, /// Whether to request a Joypad interrupt on the next CPU step. should_interrupt: bool, } impl Joypad { pub fn new() -> Self { Joypad { select_button_keys: true, select_dir_keys: true, button_keys_pressed: BitFlags::empty(), dir_keys_pressed: BitFlags::empty(), should_interrupt: false, } } pub fn button_key_down(&mut self, button: ButtonKey) { let before = self.read_reg(); self.button_keys_pressed.insert(button); let after = self.read_reg(); // Request an interrupt if a 1 bit in `before` became a 0 bit in `after`. self.should_interrupt = before & !after != 0; } pub fn button_key_up(&mut self, button: ButtonKey) { self.button_keys_pressed.remove(button); } pub fn dir_key_down(&mut self, dir: DirKey) { let before = self.read_reg(); self.dir_keys_pressed.insert(dir); let after = self.read_reg(); // Request an interrupt if a 1 bit in `before` became a 0 bit in `after`. self.should_interrupt = before & !after != 0; } pub fn dir_key_up(&mut self, dir: DirKey) { self.dir_keys_pressed.remove(dir); } pub fn read_reg(&self) -> u8 { // For all the used bits in this register, 0 actually represents `true` values of the // corresponding fields. I found it easiest to construct the opposite and then negate at // the end. // // NOTE: The top two bits of this register are unused and should always set to 1 according // to Mooneye tests. let mut bits = 0; bits |= (self.select_button_keys as u8) << 5; bits |= (self.select_dir_keys as u8) << 4; if self.select_button_keys { bits |= self.button_keys_pressed.bits(); } if self.select_dir_keys { bits |= self.dir_keys_pressed.bits(); } !bits } pub fn write_reg(&mut self, bits: u8) { // Bits 0-3 are read-only and bits 6-7 are unused and unwritable according to Mooneye. // Also, the meaning of these bits is negated (0 means `true`). self.select_button_keys = bits >> 5 & 1 == 0; self.select_dir_keys = bits >> 4 & 1 == 0; // TODO(solson): Enabling these bits can trigger the Joypad interrupt if some keys were // already being held, so we should handle interrupts here, too. (Or, more likely, in a way // that lets us do the check in a single place.) } /// Called by the CPU when executing an instruction. Returns whether to request a Joypad /// interrupt. pub fn step(&mut self) -> BitFlags<Interrupt> { if self.should_interrupt { self.should_interrupt = false; BitFlags::from(Interrupt::Joypad) } else { BitFlags::empty() } } }
// Necessary to print the struct Rectangle with println #[derive(Debug)] struct Rectangle { width: u32, height: u32, } fn main() { let rect1 = Rectangle {width: 30, height: 50}; println!( "The area of the rectangle is {} square pixels.", area(&rect1) ); // The syntax {:#?} tells the compiler to print it in debug mode I assume println!("rect1 is {:#?}", rect1); println!("Area of rect1: {}", rect1.area()); let rect2 = Rectangle {width: 25, height: 45}; let rect3 = Rectangle {width: 35, height: 55}; println!("Can rect1 hold rect2? {}", rect1.can_hold(&rect2)); println!("Can rect1 hold rect3? {}", rect1.can_hold(&rect3)); let rect4 = Rectangle::square(35); println!("{}", rect4.can_hold(&rect1)); } fn area(rect: &Rectangle) -> u32 { rect.width * rect.height } impl Rectangle { fn area(&self) -> u32 { self.width * self.height } fn can_hold(&self, rect2: &Rectangle) -> bool { (rect2.width <= self.width) && (rect2.height <= self.height) } } impl Rectangle { fn square(size: u32) -> Rectangle { Rectangle { width: size, height: size } } }
pub fn prunt() { println!("This is PRUNT"); } pub fn get() -> &'static str { "this is a string returned by module <miao>" }
// Copyright 2022 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 common_exception::ErrorCode; use common_exception::Result; use itertools::Itertools; use crate::types::array::ArrayColumnBuilder; use crate::types::decimal::DecimalColumn; use crate::types::map::KvColumnBuilder; use crate::types::nullable::NullableColumn; use crate::types::number::NumberColumn; use crate::types::string::StringColumnBuilder; use crate::types::AnyType; use crate::types::ArgType; use crate::types::ArrayType; use crate::types::BooleanType; use crate::types::DateType; use crate::types::EmptyArrayType; use crate::types::EmptyMapType; use crate::types::MapType; use crate::types::NullType; use crate::types::NullableType; use crate::types::NumberType; use crate::types::StringType; use crate::types::TimestampType; use crate::types::ValueType; use crate::types::VariantType; use crate::with_decimal_type; use crate::with_number_mapped_type; use crate::BlockEntry; use crate::Column; use crate::ColumnBuilder; use crate::DataBlock; use crate::Value; impl DataBlock { pub fn concat(blocks: &[DataBlock]) -> Result<DataBlock> { if blocks.is_empty() { return Err(ErrorCode::EmptyData("Can't concat empty blocks")); } if blocks.len() == 1 { return Ok(blocks[0].clone()); } let concat_columns = (0..blocks[0].num_columns()) .map(|i| { debug_assert!( blocks .iter() .map(|block| &block.get_by_offset(i).data_type) .all_equal() ); let columns = blocks .iter() .map(|block| { let entry = &block.get_by_offset(i); match &entry.value { Value::Scalar(s) => ColumnBuilder::repeat( &s.as_ref(), block.num_rows(), &entry.data_type, ) .build(), Value::Column(c) => c.clone(), } }) .collect::<Vec<_>>(); BlockEntry { data_type: blocks[0].get_by_offset(i).data_type.clone(), value: Value::Column(Column::concat(&columns)), } }) .collect(); let num_rows = blocks.iter().map(|c| c.num_rows()).sum(); Ok(DataBlock::new(concat_columns, num_rows)) } } impl Column { pub fn concat(columns: &[Column]) -> Column { if columns.len() == 1 { return columns[0].clone(); } let capacity = columns.iter().map(|c| c.len()).sum(); match &columns[0] { Column::Null { .. } => Self::concat_arg_types::<NullType>(columns), Column::EmptyArray { .. } => Self::concat_arg_types::<EmptyArrayType>(columns), Column::EmptyMap { .. } => Self::concat_arg_types::<EmptyMapType>(columns), Column::Number(col) => with_number_mapped_type!(|NUM_TYPE| match col { NumberColumn::NUM_TYPE(_) => { Self::concat_arg_types::<NumberType<NUM_TYPE>>(columns) } }), Column::Decimal(col) => with_decimal_type!(|DECIMAL_TYPE| match col { DecimalColumn::DECIMAL_TYPE(_, size) => { let mut builder = Vec::with_capacity(capacity); for c in columns { match c { Column::Decimal(DecimalColumn::DECIMAL_TYPE(col, size)) => { debug_assert_eq!(size, size); builder.extend_from_slice(col); } _ => unreachable!(), } } Column::Decimal(DecimalColumn::DECIMAL_TYPE(builder.into(), *size)) } }), Column::Boolean(_) => Self::concat_arg_types::<BooleanType>(columns), Column::String(_) => { let data_capacity = columns.iter().map(|c| c.memory_size() - c.len() * 8).sum(); let builder = StringColumnBuilder::with_capacity(capacity, data_capacity); Self::concat_value_types::<StringType>(builder, columns) } Column::Timestamp(_) => { let builder = Vec::with_capacity(capacity); Self::concat_value_types::<TimestampType>(builder, columns) } Column::Date(_) => { let builder = Vec::with_capacity(capacity); Self::concat_value_types::<DateType>(builder, columns) } Column::Array(col) => { let mut offsets = Vec::with_capacity(capacity + 1); offsets.push(0); let builder = ColumnBuilder::with_capacity(&col.values.data_type(), capacity); let builder = ArrayColumnBuilder { builder, offsets }; Self::concat_value_types::<ArrayType<AnyType>>(builder, columns) } Column::Map(col) => { let mut offsets = Vec::with_capacity(capacity + 1); offsets.push(0); let builder = ColumnBuilder::from_column( ColumnBuilder::with_capacity(&col.values.data_type(), capacity).build(), ); let (key_builder, val_builder) = match builder { ColumnBuilder::Tuple(fields) => (fields[0].clone(), fields[1].clone()), _ => unreachable!(), }; let builder = KvColumnBuilder { keys: key_builder, values: val_builder, }; let builder = ArrayColumnBuilder { builder, offsets }; Self::concat_value_types::<MapType<AnyType, AnyType>>(builder, columns) } Column::Nullable(_) => { let mut bitmaps = Vec::with_capacity(columns.len()); let mut inners = Vec::with_capacity(columns.len()); for c in columns { let nullable_column = NullableType::<AnyType>::try_downcast_column(c).unwrap(); inners.push(nullable_column.column); bitmaps.push(Column::Boolean(nullable_column.validity)); } let column = Self::concat(&inners); let validity = Self::concat_arg_types::<BooleanType>(&bitmaps); let validity = BooleanType::try_downcast_column(&validity).unwrap(); Column::Nullable(Box::new(NullableColumn { column, validity })) } Column::Tuple(fields) => { let fields = (0..fields.len()) .map(|idx| { let cs: Vec<Column> = columns .iter() .map(|col| col.as_tuple().unwrap()[idx].clone()) .collect(); Self::concat(&cs) }) .collect(); Column::Tuple(fields) } Column::Variant(_) => { let data_capacity = columns.iter().map(|c| c.memory_size() - c.len() * 8).sum(); let builder = StringColumnBuilder::with_capacity(capacity, data_capacity); Self::concat_value_types::<VariantType>(builder, columns) } } } fn concat_arg_types<T: ArgType>(columns: &[Column]) -> Column { let columns: Vec<T::Column> = columns .iter() .map(|c| T::try_downcast_column(c).unwrap()) .collect(); let iter = columns.iter().flat_map(|c| T::iter_column(c)); let result = T::column_from_ref_iter(iter, &[]); T::upcast_column(result) } fn concat_value_types<T: ValueType>( mut builder: T::ColumnBuilder, columns: &[Column], ) -> Column { let columns: Vec<T::Column> = columns .iter() .map(|c| T::try_downcast_column(c).unwrap()) .collect(); for col in columns { T::append_column(&mut builder, &col); } T::upcast_column(T::build_column(builder)) } }
#![no_std] #![feature(stmt_expr_attributes)] #![feature(core_intrinsics)] #![feature(test)] #![allow(clippy::many_single_char_names)] #![allow(clippy::too_many_arguments)] #![allow(clippy::needless_range_loop)] #[macro_use] pub mod utils; pub mod sha256; pub mod sha256_avx2; #[cfg(test)] mod tests { use super::*; use sha256::Sha256; use sha256_avx2::Sha256Avx2; extern crate test; use test::Bencher; #[test] fn sha256_32bytes() { let hash = Sha256::digest("wqvDrDLilCUevxUw5fWEuVc6y6ElCrHg".as_bytes()); assert_eq!( hash, [ 0xad, 0xc8, 0x24, 0x3e, 0xfd, 0x7a, 0xef, 0x68, 0x20, 0xce, 0xdc, 0xe0, 0xc9, 0xc8, 0xbe, 0x26, 0x13, 0x0a, 0xc5, 0x77, 0xde, 0x8c, 0x62, 0x1c, 0x9c, 0xa8, 0x0d, 0xd4, 0xaf, 0x19, 0x77, 0xf8 ] ); } #[test] fn sha256_64bytes() { let hash = Sha256::digest( "K7CN3VzXyY63NXmW15TKA4O6vJtVrLc7I0B5qHRtBir5PkwSt6xgJopOCunPk2ky".as_bytes(), ); assert_eq!( hash, [ 0x59, 0xd5, 0x93, 0xea, 0x4e, 0x90, 0xce, 0x36, 0x60, 0x7d, 0xc3, 0x39, 0x96, 0x9a, 0x6c, 0xe4, 0x07, 0x7b, 0xb2, 0xda, 0x86, 0x09, 0x27, 0x25, 0xfe, 0x94, 0xdb, 0xf8, 0xb1, 0x1f, 0x3e, 0x09 ] ); } #[test] fn sha256_128bytes() { let hash = Sha256::digest("KAjb6sifm7DwdyJyMXT3np6WZVfXJiEskX1fN7V8YOatxuRkpHYZmqDXY2Kn2pfnV63l0bodaXjRdVF5m2z1bC7QpdQi3UHRI9KAqWs0vO0QjT5XtkTXKlaRK4CiBsT1".as_bytes()); assert_eq!( hash, [ 0x64, 0x4c, 0xb0, 0x9c, 0x0d, 0x42, 0x26, 0x6c, 0x3a, 0x15, 0x82, 0x6c, 0xec, 0xaf, 0x91, 0x93, 0xfa, 0x05, 0x9d, 0x10, 0x22, 0xed, 0xd6, 0xdb, 0x3a, 0x5a, 0x4c, 0xb7, 0x19, 0x03, 0x12, 0x24 ] ); } #[test] fn sha256_256bytes() { let hash = Sha256::digest("QnpFg2P1SEQ0L9tcNwBROCW7jVtFeMt0RuF7QODKkgD75CPDi1pAB1GtMcq0G1pmNE6J3IuPpF33uPtOs4sNwU7lKcnF8SU016PKWPeVEpuKQ2ksT9enIf1hVrzlypOkhFTFhIS28IT9OQZ3BS3693487mSb6QNuuaBCD8yNWWlo74c79EFWUWNaAmRcSxVaNcbDa80SovlnL8lyO2yS7XlmE7rPmLI4IvPtko3QguI4Th2JPrVnM7QCCjMgvlIO".as_bytes()); assert_eq!( hash, [ 0x68, 0x7f, 0x3b, 0x1d, 0xe7, 0x47, 0x02, 0x47, 0x55, 0xb3, 0x6f, 0x87, 0xd4, 0x1f, 0x02, 0x66, 0x07, 0xd1, 0x20, 0x57, 0x18, 0x4a, 0xf4, 0x68, 0xb0, 0x39, 0xad, 0x28, 0x41, 0xed, 0x43, 0xe4 ] ); } #[test] fn sha256_avx2_32bytes() { let hash = Sha256Avx2::digest("wqvDrDLilCUevxUw5fWEuVc6y6ElCrHg".as_bytes()); assert_eq!( hash[0], [ 0xad, 0xc8, 0x24, 0x3e, 0xfd, 0x7a, 0xef, 0x68, 0x20, 0xce, 0xdc, 0xe0, 0xc9, 0xc8, 0xbe, 0x26, 0x13, 0x0a, 0xc5, 0x77, 0xde, 0x8c, 0x62, 0x1c, 0x9c, 0xa8, 0x0d, 0xd4, 0xaf, 0x19, 0x77, 0xf8 ] ); } #[test] fn sha256_avx2_64bytes() { let hash = Sha256Avx2::digest( "K7CN3VzXyY63NXmW15TKA4O6vJtVrLc7I0B5qHRtBir5PkwSt6xgJopOCunPk2ky".as_bytes(), ); assert_eq!( hash[0], [ 0x59, 0xd5, 0x93, 0xea, 0x4e, 0x90, 0xce, 0x36, 0x60, 0x7d, 0xc3, 0x39, 0x96, 0x9a, 0x6c, 0xe4, 0x07, 0x7b, 0xb2, 0xda, 0x86, 0x09, 0x27, 0x25, 0xfe, 0x94, 0xdb, 0xf8, 0xb1, 0x1f, 0x3e, 0x09 ] ); } #[test] fn sha256_avx2_128bytes() { let hash = Sha256Avx2::digest("KAjb6sifm7DwdyJyMXT3np6WZVfXJiEskX1fN7V8YOatxuRkpHYZmqDXY2Kn2pfnV63l0bodaXjRdVF5m2z1bC7QpdQi3UHRI9KAqWs0vO0QjT5XtkTXKlaRK4CiBsT1".as_bytes()); assert_eq!( hash[0], [ 0x64, 0x4c, 0xb0, 0x9c, 0x0d, 0x42, 0x26, 0x6c, 0x3a, 0x15, 0x82, 0x6c, 0xec, 0xaf, 0x91, 0x93, 0xfa, 0x05, 0x9d, 0x10, 0x22, 0xed, 0xd6, 0xdb, 0x3a, 0x5a, 0x4c, 0xb7, 0x19, 0x03, 0x12, 0x24 ] ); } #[test] fn sha256_avx2_256bytes() { let hash = Sha256Avx2::digest("QnpFg2P1SEQ0L9tcNwBROCW7jVtFeMt0RuF7QODKkgD75CPDi1pAB1GtMcq0G1pmNE6J3IuPpF33uPtOs4sNwU7lKcnF8SU016PKWPeVEpuKQ2ksT9enIf1hVrzlypOkhFTFhIS28IT9OQZ3BS3693487mSb6QNuuaBCD8yNWWlo74c79EFWUWNaAmRcSxVaNcbDa80SovlnL8lyO2yS7XlmE7rPmLI4IvPtko3QguI4Th2JPrVnM7QCCjMgvlIO".as_bytes()); assert_eq!( hash[0], [ 0x68, 0x7f, 0x3b, 0x1d, 0xe7, 0x47, 0x02, 0x47, 0x55, 0xb3, 0x6f, 0x87, 0xd4, 0x1f, 0x02, 0x66, 0x07, 0xd1, 0x20, 0x57, 0x18, 0x4a, 0xf4, 0x68, 0xb0, 0x39, 0xad, 0x28, 0x41, 0xed, 0x43, 0xe4 ] ); } #[bench] fn bench_sha256_32bytes(b: &mut Bencher) { b.iter(|| { Sha256::digest("wqvDrDLilCUevxUw5fWEuVc6y6ElCrHg".as_bytes()); }); } #[bench] fn bench_sha256_64bytes(b: &mut Bencher) { b.iter(|| { Sha256::digest( "K7CN3VzXyY63NXmW15TKA4O6vJtVrLc7I0B5qHRtBir5PkwSt6xgJopOCunPk2ky".as_bytes(), ); }); } #[bench] fn bench_sha256_128bytes(b: &mut Bencher) { b.iter(|| { Sha256::digest("KAjb6sifm7DwdyJyMXT3np6WZVfXJiEskX1fN7V8YOatxuRkpHYZmqDXY2Kn2pfnV63l0bodaXjRdVF5m2z1bC7QpdQi3UHRI9KAqWs0vO0QjT5XtkTXKlaRK4CiBsT1".as_bytes()); }); } #[bench] fn bench_sha256_256bytes(b: &mut Bencher) { b.iter(|| { Sha256::digest("QnpFg2P1SEQ0L9tcNwBROCW7jVtFeMt0RuF7QODKkgD75CPDi1pAB1GtMcq0G1pmNE6J3IuPpF33uPtOs4sNwU7lKcnF8SU016PKWPeVEpuKQ2ksT9enIf1hVrzlypOkhFTFhIS28IT9OQZ3BS3693487mSb6QNuuaBCD8yNWWlo74c79EFWUWNaAmRcSxVaNcbDa80SovlnL8lyO2yS7XlmE7rPmLI4IvPtko3QguI4Th2JPrVnM7QCCjMgvlIO".as_bytes()); }); } #[bench] fn bench_sha256_avx2_32bytes(b: &mut Bencher) { b.iter(|| { Sha256Avx2::digest("wqvDrDLilCUevxUw5fWEuVc6y6ElCrHg".as_bytes()); }); } #[bench] fn bench_sha256_avx2_64bytes(b: &mut Bencher) { b.iter(|| { Sha256Avx2::digest( "K7CN3VzXyY63NXmW15TKA4O6vJtVrLc7I0B5qHRtBir5PkwSt6xgJopOCunPk2ky".as_bytes(), ); }); } #[bench] fn bench_sha256_avx2_128bytes(b: &mut Bencher) { b.iter(|| { Sha256Avx2::digest("KAjb6sifm7DwdyJyMXT3np6WZVfXJiEskX1fN7V8YOatxuRkpHYZmqDXY2Kn2pfnV63l0bodaXjRdVF5m2z1bC7QpdQi3UHRI9KAqWs0vO0QjT5XtkTXKlaRK4CiBsT1".as_bytes()); }); } #[bench] fn bench_sha256_avx2_256bytes(b: &mut Bencher) { b.iter(|| { Sha256Avx2::digest("QnpFg2P1SEQ0L9tcNwBROCW7jVtFeMt0RuF7QODKkgD75CPDi1pAB1GtMcq0G1pmNE6J3IuPpF33uPtOs4sNwU7lKcnF8SU016PKWPeVEpuKQ2ksT9enIf1hVrzlypOkhFTFhIS28IT9OQZ3BS3693487mSb6QNuuaBCD8yNWWlo74c79EFWUWNaAmRcSxVaNcbDa80SovlnL8lyO2yS7XlmE7rPmLI4IvPtko3QguI4Th2JPrVnM7QCCjMgvlIO".as_bytes()); }); } }
use std::collections::HashMap; fn call(number: &str) -> &str { match number { "798-1364" => "We're sorry, the call cannot be completed as dialed. Please hang up and try again.", "645-7689" => "Hello, this is Mr. Awesome's Pizza. My name is Fred. What can I get for you today?", _ => "Hi! Who is this again?" } } fn main() { let mut contacts = HashMap::new(); contacts.insert("Daniel", "798-1364"); contacts.insert("Gabriel", "645-7689"); contacts.insert("Camilla", "435-8291"); contacts.insert("MariaInes", "555-1745"); contacts.insert("Edgardo", "832-2012"); contacts.insert("Alejandra", "821-5423"); contacts.insert("Maria Ines", "821-5423"); contacts.insert("Christina", "212-9321"); contacts.insert("Papo", "312-3429"); // Takes a reference and returns Option<&V> match contacts.get(&"Daniel") { Some(&number) => println!("Calling Daniel: {}", call(number)), _ => println!("Don't have Daniel's number."), } // `HashMap::insert()` returns true // if the inserted value is new, false otherwise contacts.insert("Daniel", "164-6743"); match contacts.get(&"Camilla") { Some(&number) => println!("Calling Camilla: {}", call(number)), _ => println!("Don't have Camilla's number."), } contacts.remove(&("Camilla")); contacts.remove(&("MariaInes")); // `HashMap::iter()` returns an iterator that yields // (&'a key, &'a value) pairs in arbitrary order. for (contact, &number) in contacts.iter() { println!("Calling {}: {}", contact, call(number)); } }
use sea_orm::{entity::prelude::*, ActiveValue}; use serde::{Deserialize, Serialize}; use crate::seconds_since_epoch; #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] #[sea_orm(rs_type = "i16", db_type = "SmallInteger")] pub enum UserRole { #[sea_orm(num_value = 0)] Default, } impl From<UserRole> for i16 { fn from(role: UserRole) -> i16 { match role { UserRole::Default => 0, } } } #[derive(Copy, Clone, Default, Debug, DeriveEntity)] pub struct Entity; impl EntityName for Entity { fn table_name(&self) -> &str { "user" } } #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)] pub struct Model { pub id: String, pub role: i16, pub username: String, pub hashed_password: String, pub created_at: i64, pub updated_at: i64, } impl Model { pub fn get_role(&self) -> UserRole { match self.role { 0 => UserRole::Default, _ => panic!("invalid role"), } } } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] pub enum Column { Id, Role, Username, HashedPassword, CreatedAt, UpdatedAt, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] pub enum PrimaryKey { Id, } impl PrimaryKeyTrait for PrimaryKey { type ValueType = String; fn auto_increment() -> bool { false } } #[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation {} impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { Self::Id => ColumnType::String(None).def().unique(), Self::Role => ColumnType::SmallInteger.def(), Self::Username => ColumnType::String(None).def().unique(), Self::HashedPassword => ColumnType::String(None).def(), Self::CreatedAt => ColumnType::BigInteger.def(), Self::UpdatedAt => ColumnType::BigInteger.def(), } } } impl RelationTrait for Relation { fn def(&self) -> RelationDef { panic!("No RelationDef") } } impl ActiveModelBehavior for ActiveModel { fn new() -> Self { Self { id: ActiveValue::Set(Uuid::new_v4().to_string()), role: ActiveValue::Set(UserRole::Default.into()), ..<Self as ActiveModelTrait>::default() } } fn before_save(mut self, insert: bool) -> Result<Self, DbErr> { let now: i64 = seconds_since_epoch(); self.updated_at = ActiveValue::Set(now); if insert { self.created_at = ActiveValue::Set(now); } Ok(self) } }
use std::collections::HashMap; use fileutil; #[derive(Clone,Copy,PartialEq,Eq,Hash,Debug)] struct Point { x: i32, y: i32 } impl Point { pub fn parse_point(point_str: &str) -> Point { let mut splits = point_str.split(","); Point { x: splits.next().and_then(|s| s.trim().parse::<i32>().ok()).unwrap(), y: splits.next().and_then(|s| s.trim().parse::<i32>().ok()).unwrap(), } } } #[derive(Debug)] struct Segment { start: Point, end: Point } impl Segment { pub fn parse_segment(line: &str) -> Segment { let mut splits = line.split("->"); Segment { start: Point::parse_point(splits.next().unwrap()), end: Point::parse_point(splits.next().unwrap()) } } pub fn points(&self) -> Vec<Point> { let raw_dx = self.end.x - self.start.x; let raw_dy = self.end.y - self.start.y; let dx = i32::signum(raw_dx); let dy = i32::signum(raw_dy); let mut ret = Vec::with_capacity(i32::abs(raw_dx.min(raw_dy)) as usize); let mut cur_point = self.start; while cur_point != self.end { ret.push(cur_point); cur_point = Point { x: cur_point.x + dx, y: cur_point.y + dy } } ret.push(self.end); ret } pub fn is_vertical(&self) -> bool { self.start.x == self.end.x } pub fn is_horizontal(&self) -> bool { self.start.y == self.end.y } } fn run_part(vert_or_horiz_only: bool) { let lines = fileutil::read_lines("data/2021/05.txt").unwrap(); let segments: Vec<Segment> = lines.into_iter() .map(|s| Segment::parse_segment(&s)) .collect(); let mut points: HashMap<Point, i32> = HashMap::new(); for segment in segments { if vert_or_horiz_only && !segment.is_vertical() && !segment.is_horizontal() { continue; } for point in segment.points() { let entry = points.entry(point).or_insert(0); *entry += 1; } } let ge2_overlaps = points.values().filter(|v| **v >= 2).count(); println!("{}", ge2_overlaps); } pub fn run() { run_part(false); }
use crate::screqs::requests::TweetInfo; use rusqlite::{params, Connection, Result, ToSql}; use std::path::Path; pub fn create_conn() -> Result<Connection> { let path = Path::new("ts.db"); let conn = Connection::open(path); return conn; } pub fn create_tweet_table(conn: &Connection) -> std::result::Result<(), String> { conn.execute( "create table if not exists mam_tweets ( tweet_id int not null constraint mam_tweets_pk primary key, user_id int not null, truncated int not null, tweet_text text not null, user_name text not null, user_screen_name text not null );", params![], ) .unwrap(); conn.execute( "create index if not exists mam_tweets_user_id_index on mam_tweets (user_id);", params![], ) .unwrap(); conn.execute( "create index if not exists mam_tweets_truncated_index on mam_tweets (truncated);", params![], ) .unwrap(); return Ok(()); } fn create_prep_value_packs(num_packs: usize, num_params_per_pack: u32) -> String { let mut sb = String::with_capacity(256); for j in 0..num_packs { sb.push('('); for i in 1..(num_params_per_pack) { sb.push('?'); sb.push_str(&i.to_string()); sb.push(','); } sb.push_str(&num_params_per_pack.to_string()); sb.push(')'); if j != (num_packs - 1) { sb.push(','); } } return sb; } pub fn insert_replace_tweets( conn: &Connection, twinfos: &Vec<TweetInfo>, ) -> std::result::Result<(), String> { let num_fields = 6; // TODO: Batches //let packs = create_prep_value_packs(twinfos.len(), num_fields); let q = "insert or replace into mam_tweets (tweet_id, user_id, truncated, tweet_text, user_name, user_screen_name) VALUES (?1,?2,?3,?4,?5,?6);"; println!("{}", q); for twinfo in twinfos { let params = params!( twinfo.tweet_id().to_string(), twinfo.user_id().to_string(), if twinfo.truncated() { "1".to_string() } else { "0".to_string() }, twinfo.tweet_text().to_string(), twinfo.user_name().to_string(), twinfo.user_screen_name().to_string(), ); conn.execute(&q, params).unwrap(); } return Ok(()); }
mod codec; pub mod client_streaming; pub mod server_streaming; pub mod streaming; pub mod unary; pub use self::codec::{Codec, Encoder, Decoder, Decode, Encode}; pub use self::streaming::Grpc; pub use self::client_streaming::ClientStreaming; pub use self::server_streaming::ServerStreaming; pub use self::unary::Unary; use {Request, Response}; use futures::{Poll}; use futures::future::{self, FutureResult}; use tower::Service; /// A gRPC service that responds to all requests with not implemented #[derive(Debug)] pub struct NotImplemented<T, U> { _p: ::std::marker::PhantomData<(T, U)>, } // ===== impl NotImplemented ===== impl<T, U> NotImplemented<T, U> { pub fn new() -> Self { NotImplemented { _p: ::std::marker::PhantomData, } } } impl<T, U> Service for NotImplemented<T, U> { type Request = Request<T>; type Response = Response<U>; type Error = ::Error; type Future = FutureResult<Self::Response, Self::Error>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { Ok(().into()) } fn call(&mut self, _: Self::Request) -> Self::Future { future::err(::Error::Grpc(::Status::UNIMPLEMENTED)) } } impl<T, U> Clone for NotImplemented<T, U> { fn clone(&self) -> Self { NotImplemented { _p: ::std::marker::PhantomData, } } }
extern crate rand; use rand::prelude::*; use rand::Rng; use crate::base::Mat; use crate::base::Vector; use crate::base::Layer; pub struct Conv2d { pub input: Mat, pub output: Mat, pub input_width: usize, pub input_height: usize, pub kernel_size: usize, pub kernal_num: usize, pub strides: usize, pub padding: usize, pub weights: Mat, pub grads: Mat, } impl Conv2d { pub fn new( input_width: usize, input_height: usize, kernel_size: usize, kernal_num: usize, strides: usize, padding: usize, ) -> Self { let grads: Mat = vec![vec![0.0f32; kernel_size * kernel_size]; kernal_num]; let mut rng = rand::thread_rng(); let weights = (0..kernal_num) .map(|_| { (0..kernel_size * kernel_size) .map(|_| rng.gen::<f32>()) .collect() }) .collect(); Conv2d { input: vec![vec![]], output: vec![vec![]], input_width: input_width, input_height: input_height, kernel_size: kernel_size, kernal_num: kernal_num, strides: strides, padding: padding, weights: weights, grads: grads, } } } impl Layer for Conv2d { fn forward(&mut self, input: &Mat, _: bool) -> Mat { self.input = input.clone(); let rs = conv2d( input, self.input_height, self.input_width, &self.weights, self.kernel_size, self.padding, self.strides, ); self.output = rs.clone(); rs } fn backward(&mut self, up_grads: &Mat) -> Mat { for (i, ug) in up_grads.iter().enumerate() { for (j, grads) in ug.iter().enumerate() { self.grads[i][j] = grads * self.input[i][j]; } } self.grads.clone() } fn update_weights(&mut self, lamda: f32) { let z = &self.grads; for i in 0..self.weights.len() { for j in 0..self.weights[i].len() { self.weights[i][j] = self.weights[i][j] - lamda * z[i][j]; } } } fn clear(&mut self) { self.grads = vec![vec![0.0f32; self.kernel_size * self.kernel_size]; self.kernal_num]; } }
use actix_web::actix::Addr; use crate::model::{db::Database, graphql::GraphQLExecutor}; use crate::share::common::Claims; use slog::Logger; pub struct AppState { pub logger: Logger, pub db: Addr<Database>, pub gql_executor: Addr<GraphQLExecutor>, pub claims: Option<Claims>, }
use futures::future; use model::server::SamotopServer; use server; use service::SamotopService; use tokio::prelude::Future; pub struct Samotop<S> where S: SamotopService + Clone, { pub default_port: &'static str, pub default_service: S, } impl<S> Samotop<S> where S: SamotopService + Clone, { pub fn with<SX>(&self, factory: SX) -> SamotopBuilder<SX> where SX: SamotopService + Clone + Send + Sync + 'static, { SamotopBuilder::new(self.default_port.into(), factory) } } #[derive(Clone)] pub struct SamotopBuilder<S> where S: SamotopService + Clone, { default_port: String, ports: Vec<String>, factory: S, } impl<S> SamotopBuilder<S> where S: SamotopService + Clone + Send + Sync + 'static, { pub fn new(default_port: String, factory: S) -> Self { Self { default_port, ports: vec![], factory, } } pub fn with<SX>(self, factory: SX) -> SamotopBuilder<SX> where SX: SamotopService + Clone, { let Self { default_port, ports, .. } = self; SamotopBuilder { default_port, factory, ports, } } pub fn on(self, port: impl ToString) -> Self { let mut me = self.clone(); me.ports.push(port.to_string()); me } pub fn on_all<P>(self, ports: impl IntoIterator<Item = P>) -> Self where P: ToString, { let mut me = self.clone(); me.ports .extend(ports.into_iter().map(|port| port.to_string())); me } pub fn as_task(self) -> impl Future<Item = (), Error = ()> { let Self { default_port, ports, factory, } = self; let ports = match ports.len() { 0 => vec![default_port], _ => ports, }; future::join_all(ports.into_iter().map(move |addr| { server::serve(SamotopServer { addr, factory: factory.clone(), }) })).map(|_| ()) } }
use proconio::{input, marker::Usize1}; use std::collections::HashMap; fn main() { input! { n: usize, a: [u64; n], q: usize, }; let mut plus = HashMap::<usize, u64>::new(); for i in 0..n { plus.insert(i, a[i]); } let mut last_op1: Option<u64> = None; for _ in 0..q { input! { op: u8, }; if op == 1 { input! { x: u64, }; last_op1 = Some(x); plus.clear(); } else if op == 2 { input! { i: Usize1, x: u64, }; *plus.entry(i).or_insert(0) += x; } else { input! { i: Usize1, }; let ans = plus.get(&i).unwrap_or(&0) + last_op1.unwrap_or(0); println!("{}", ans); } } }
use crate::js_object_utils::{get_bool, get_vec_of_strings}; use eyeliner::AbstractOptions; use neon::{context::Context, handle::Handle, result::Throw, types::JsObject}; pub fn js_options_object_to_rust_options_struct<'a, C: Context<'a>, E: From<Throw>>( cx: &mut C, options: Handle<'a, JsObject>, ) -> Result<AbstractOptions, E> { let eyeliner_options = AbstractOptions { apply_table_element_attributes: get_bool(cx, options, "applyTableElementAttributes")?, apply_height_attributes: get_bool(cx, options, "applyHeightAttributes")?, apply_style_tags: get_bool(cx, options, "applyStyleTags")?, apply_width_attributes: get_bool(cx, options, "applyWidthAttributes")?, insert_preserved_css: get_vec_of_strings(cx, options, "insertPreservedCss")?, preserve_font_faces: get_bool(cx, options, "preserveFontFaces")?, preserve_important: get_bool(cx, options, "preserveImportant")?, preserve_media_queries: get_bool(cx, options, "preserveMediaQueries")?, remove_style_tags: get_bool(cx, options, "removeStyleTags")?, }; Ok(eyeliner_options) }
use crate::{Identifier, Position}; use std::error; use std::fmt; /// The error type of `Interpreter`. #[derive(Debug)] pub enum InterpreterError { /// An unknown variable name was found. UnknownVariable { name: Identifier, position: Position, }, /// The wrong type was given. TypeError { expected: &'static str, found: &'static str, position: Position, }, /// The number of arguments given does not match the expected number of arguments. ArgumentError { got: usize, takes: usize, position: Position, }, /// `ArgumentError`, but for built-in functions. BuiltinArgumentError { name: &'static str, got: usize, takes: &'static str, }, /// `TypeError`, but for built-in functions. BuiltinTypeError { name: &'static str, expected: &'static str, found: &'static str, }, } impl fmt::Display for InterpreterError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use self::InterpreterError::*; match self { UnknownVariable { name, position } => { write!(f, "unknown variable {} at {}", name, position) } TypeError { expected, found, position, } => write!( f, "type error: expected {} at {}, found {}", expected, position, found ), ArgumentError { got, takes, position, } => write!( f, "function at {} takes {} arguments, but got {}", position, takes, got, ), BuiltinArgumentError { name, got, takes } => write!( f, "built-in function {} takes {} arguments, but got {}", name, takes, got ), BuiltinTypeError { name, found, expected, } => write!( f, "built-in function {} expected argument of type {}, but got {}", name, expected, found ), } } } impl error::Error for InterpreterError {}
use super::{Chunk, Chunks}; use crate::internal_data_structure::raw_bit_vector::RawBitVector; impl super::Chunks { /// Constructor. pub fn new(rbv: &RawBitVector) -> Self { let n = rbv.length(); let chunk_size: u16 = Chunks::calc_chunk_size(n); let chunks_cnt: u64 = Chunks::calc_chunks_cnt(n); let mut chunks: Vec<Chunk> = Vec::with_capacity(chunks_cnt as usize); for i_chunk in 0..(chunks_cnt as usize) { let this_chunk_size: u16 = if i_chunk as u64 == chunks_cnt - 1 { // When `chunk_size == 6`: // // 000 111 000 11 : rbv // | | | : chunks // // Here, when `i_chunk == 1` (targeting on last '00011' chunk), // `this_chunk_size == 5` let chunk_size_or_0 = (n % chunk_size as u64) as u16; if chunk_size_or_0 == 0 { chunk_size } else { chunk_size_or_0 } } else { chunk_size }; let chunk_rbv = rbv.copy_sub(i_chunk as u64 * chunk_size as u64, this_chunk_size as u64); let popcnt_in_chunk = chunk_rbv.popcount(); let chunk = Chunk::new( popcnt_in_chunk + if i_chunk == 0 { 0 } else { chunks[i_chunk - 1].value }, this_chunk_size, rbv, i_chunk as u64, ); chunks.push(chunk); } Self { chunks, chunks_cnt } } /// Returns size of 1 chunk: _(log N)^2_. pub fn calc_chunk_size(n: u64) -> u16 { let lg2 = (n as f64).log2() as u16; let sz = lg2 * lg2; if sz == 0 { 1 } else { sz } } /// Returns count of chunks: _N / (log N)^2_. /// /// At max: N / (log N)^2 = 2^64 / 64^2 = 2^(64-12) pub fn calc_chunks_cnt(n: u64) -> u64 { let chunk_size = Chunks::calc_chunk_size(n); n / (chunk_size as u64) + if n % (chunk_size as u64) == 0 { 0 } else { 1 } } /// Returns i-th chunk. /// /// # Panics /// When _`i` >= `self.chunks_cnt()`_. pub fn access(&self, i: u64) -> &Chunk { assert!( i <= self.chunks_cnt, "i = {} must be smaller then {} (self.chunks_cnt())", i, self.chunks_cnt ); &self.chunks[i as usize] } } #[cfg(test)] mod new_success_tests { use super::super::BitString; use super::Chunks; use crate::internal_data_structure::raw_bit_vector::RawBitVector; struct Input<'a> { in_s: &'a str, expected_chunk_size: u16, expected_chunks: &'a Vec<u64>, } macro_rules! parameterized_tests { ($($name:ident: $value:expr,)*) => { $( #[test] fn $name() { let input: Input = $value; let rbv = RawBitVector::from_bit_string(&BitString::new(input.in_s)); let n = rbv.length(); let chunks = Chunks::new(&rbv); assert_eq!(Chunks::calc_chunk_size(n), input.expected_chunk_size); assert_eq!(Chunks::calc_chunks_cnt(n), input.expected_chunks.len() as u64); for (i, expected_chunk) in input.expected_chunks.iter().enumerate() { let chunk = chunks.access(i as u64); assert_eq!(chunk.value(), *expected_chunk); } } )* } } parameterized_tests! { t1: Input { in_s: "0", // N = 1, (log_2(N))^2 = 1 expected_chunk_size: 1, expected_chunks: &vec!(0) }, t2: Input { in_s: "1", // N = 1, (log_2(N))^2 = 1 expected_chunk_size: 1, expected_chunks: &vec!(1) }, t3: Input { in_s: "0111", // N = 2^2, (log_2(N))^2 = 4 expected_chunk_size: 4, expected_chunks: &vec!(3) }, t4: Input { in_s: "0111_1101", // N = 2^3, (log_2(N))^2 = 9 expected_chunk_size: 9, expected_chunks: &vec!(6) }, t5: Input { in_s: "0111_1101_1", // N = 2^3 + 1, (log_2(N))^2 = 9 expected_chunk_size: 9, expected_chunks: &vec!(7) }, t6: Input { in_s: "0111_1101_11", // N = 2^3 + 2, (log_2(N))^2 = 9 expected_chunk_size: 9, expected_chunks: &vec!(7, 8) }, bugfix_11: Input { in_s: "11", // N = 2^1, (log_2(N))^2 = 4 expected_chunk_size: 1, expected_chunks: &vec!(1, 2) }, bugfix_11110110_11010101_01000101_11101111_10101011_10100101_01100011_00110100_01010101_10010000_01001100_10111111_00110011_00111110_01110101_11011100: Input { in_s: "11110110_11010101_01000101_11101111_10101011_10100101_0__1100011_00110100_01010101_10010000_01001100_10111111_00__110011_00111110_01110101_11011100", // N = 8 * 16 = 2^7, (log_2(N))^2 = 49 expected_chunk_size: 49, expected_chunks: &vec!(30, 53, 72) }, } }
pub type INotificationActivationCallback = *mut ::core::ffi::c_void; #[repr(C)] #[doc = "*Required features: `\"Win32_UI_Notifications\"`*"] pub struct NOTIFICATION_USER_INPUT_DATA { pub Key: ::windows_sys::core::PCWSTR, pub Value: ::windows_sys::core::PCWSTR, } impl ::core::marker::Copy for NOTIFICATION_USER_INPUT_DATA {} impl ::core::clone::Clone for NOTIFICATION_USER_INPUT_DATA { fn clone(&self) -> Self { *self } }
use crate::actors_manager::ActorManagerProxyCommand; use crate::envelope::ManagerLetter; use crate::system::AddressBook; use crate::{Actor, Handle}; use std::fmt::Debug; /// This object is provided to the [Handle](./trait.Handle.html) method for each message that an Actor receives /// The Actor's assistant allows to send messages and to execute some task over the system. /// /// ```rust,no_run /// # use acteur::{Actor, Handle, Assistant, System}; /// # use async_trait::async_trait; /// # /// # #[derive(Debug)] /// # struct Employee { /// # salary: u32, /// # manager_id: u32, /// # } /// # /// # #[async_trait] /// # impl Actor for Employee { /// # type Id = u32; /// # /// # async fn activate(_: Self::Id) -> Self { /// # Employee { /// # salary: 0, // Load from DB or set a default, /// # manager_id: 0 , /// # } /// # } /// # } /// # /// # #[derive(Debug)] /// # struct Manager; /// # /// # #[async_trait] /// # impl Actor for Manager { /// # type Id = u32; /// # /// # async fn activate(_: Self::Id) -> Self { /// # Manager /// # } /// # } /// # #[async_trait] /// # impl Handle<SayByeForever> for Manager { /// # async fn handle(&mut self, message: SayByeForever, assistant: Assistant) {} /// # } /// #[derive(Debug)] /// struct SalaryChanged(u32); /// /// #[derive(Debug)] /// struct SayByeForever(String); /// /// #[async_trait] /// impl Handle<SalaryChanged> for Employee { /// async fn handle(&mut self, message: SalaryChanged, assistant: Assistant) { /// if self.salary > message.0 { /// assistant.send::<Manager, SayByeForever>(self.manager_id, SayByeForever("Betrayer!".to_string())); /// } /// /// self.salary = message.0; /// } /// } /// /// # fn main() { /// # let sys = System::new(); /// # /// # sys.send::<Employee, SalaryChanged>(42, SalaryChanged(55000)); /// # /// # sys.wait_until_stopped(); /// # } /// /// ``` /// pub struct Assistant { address_book: AddressBook, } impl Assistant { pub(crate) fn new(address_book: AddressBook) -> Assistant { Assistant { address_book } } /// Sends a message to the Actor with the specified Id. /// If the Actor is not loaded, it will load the actor before, calling its method `activate` pub async fn send<A: Actor + Handle<M>, M: Debug + Send + 'static>( &self, actor_id: A::Id, message: M, ) { if let Some(sender) = self.address_book.get::<A>() { sender .send(ActorManagerProxyCommand::Dispatch(Box::new( ManagerLetter::<A, M>::new(actor_id, message), ))) .await; } } /// Send an stop message to all actors in the system. /// Actors will process all the enqued messages before stop pub async fn stop_system(&self) { self.address_book.stop_all(); } } impl Clone for Assistant { fn clone(&self) -> Self { Assistant { address_book: self.address_book.clone(), } } } impl Debug for Assistant { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "ActorSecretary ()") } }
extern crate hw; use hw::problem3::sieve; use hw::problem4::{hanoi, Peg}; use hw::problem5::{bloom, jenkins, fnv, djb2}; pub fn main() { println!("{:?}", sieve(12)); hanoi(5, Peg::A, Peg::B, Peg::C); let data = vec!["apple", "blueberry", "carrot", "date", "eggplant", "fig", "grapefruit"]; let hashes = [djb2, fnv, jenkins]; bloom(&data, hashes, "carrot"); bloom(&data, hashes, "milk"); bloom(&data, hashes, "bread"); }
//! [`Equivalent`] and [`Comparable`] are traits for key comparison in maps. //! //! These may be used in the implementation of maps where the lookup type `Q` //! may be different than the stored key type `K`. //! //! * `Q: Equivalent<K>` checks for equality, similar to the `HashMap<K, V>` //! constraint `K: Borrow<Q>, Q: Eq`. //! * `Q: Comparable<K>` checks the ordering, similar to the `BTreeMap<K, V>` //! constraint `K: Borrow<Q>, Q: Ord`. //! //! These traits are not used by the maps in the standard library, but they may //! add more flexibility in third-party map implementations, especially in //! situations where a strict `K: Borrow<Q>` relationship is not available. //! //! # Examples //! //! ``` //! use equivalent::*; //! use std::cmp::Ordering; //! //! pub struct Pair<A, B>(pub A, pub B); //! //! impl<'a, A: ?Sized, B: ?Sized, C, D> Equivalent<(C, D)> for Pair<&'a A, &'a B> //! where //! A: Equivalent<C>, //! B: Equivalent<D>, //! { //! fn equivalent(&self, key: &(C, D)) -> bool { //! self.0.equivalent(&key.0) && self.1.equivalent(&key.1) //! } //! } //! //! impl<'a, A: ?Sized, B: ?Sized, C, D> Comparable<(C, D)> for Pair<&'a A, &'a B> //! where //! A: Comparable<C>, //! B: Comparable<D>, //! { //! fn compare(&self, key: &(C, D)) -> Ordering { //! match self.0.compare(&key.0) { //! Ordering::Equal => self.1.compare(&key.1), //! not_equal => not_equal, //! } //! } //! } //! //! fn main() { //! let key = (String::from("foo"), String::from("bar")); //! let q1 = Pair("foo", "bar"); //! let q2 = Pair("boo", "bar"); //! let q3 = Pair("foo", "baz"); //! //! assert!(q1.equivalent(&key)); //! assert!(!q2.equivalent(&key)); //! assert!(!q3.equivalent(&key)); //! //! assert_eq!(q1.compare(&key), Ordering::Equal); //! assert_eq!(q2.compare(&key), Ordering::Less); //! assert_eq!(q3.compare(&key), Ordering::Greater); //! } //! ``` #![no_std] use core::borrow::Borrow; use core::cmp::Ordering; /// Key equivalence trait. /// /// This trait allows hash table lookup to be customized. It has one blanket /// implementation that uses the regular solution with `Borrow` and `Eq`, just /// like `HashMap` does, so that you can pass `&str` to lookup into a map with /// `String` keys and so on. /// /// # Contract /// /// The implementor **must** hash like `K`, if it is hashable. pub trait Equivalent<K: ?Sized> { /// Compare self to `key` and return `true` if they are equal. fn equivalent(&self, key: &K) -> bool; } impl<Q: ?Sized, K: ?Sized> Equivalent<K> for Q where Q: Eq, K: Borrow<Q>, { #[inline] fn equivalent(&self, key: &K) -> bool { PartialEq::eq(self, key.borrow()) } } /// Key ordering trait. /// /// This trait allows ordered map lookup to be customized. It has one blanket /// implementation that uses the regular solution with `Borrow` and `Ord`, just /// like `BTreeMap` does, so that you can pass `&str` to lookup into a map with /// `String` keys and so on. pub trait Comparable<K: ?Sized>: Equivalent<K> { /// Compare self to `key` and return their ordering. fn compare(&self, key: &K) -> Ordering; } impl<Q: ?Sized, K: ?Sized> Comparable<K> for Q where Q: Ord, K: Borrow<Q>, { #[inline] fn compare(&self, key: &K) -> Ordering { Ord::cmp(self, key.borrow()) } }
// Copyright 2022 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::io::Cursor; use std::io::Read; use chrono::DateTime; use chrono::Datelike; use chrono::Duration; use chrono::FixedOffset; use chrono::NaiveDate; use chrono::Offset; use chrono::TimeZone; use chrono_tz::Tz; use common_exception::ErrorCode; use common_exception::Result; use common_exception::ToErrorCode; use crate::cursor_ext::cursor_read_bytes_ext::ReadBytesExt; pub trait BufferReadDateTimeExt { fn read_date_text(&mut self, tz: &Tz) -> Result<NaiveDate>; fn read_timestamp_text(&mut self, tz: &Tz) -> Result<DateTime<Tz>>; fn parse_time_offset( &mut self, tz: &Tz, buf: &mut Vec<u8>, dt: &DateTime<Tz>, west_tz: bool, calc_offset: impl Fn(i64, i64, &DateTime<Tz>) -> Result<DateTime<Tz>>, ) -> Result<DateTime<Tz>>; } const DATE_LEN: usize = 10; fn parse_time_part(buf: &[u8], size: usize) -> Result<u32> { if size > 0 && size < 3 { Ok(lexical_core::FromLexical::from_lexical(buf).unwrap()) } else { let msg = format!( "err with parse time part. Format like this:[03:00:00], got {} digits", size ); Err(ErrorCode::BadBytes(msg)) } } // fn calc_offset(current_tz_sec: i64, val_tz_sec: i64, dt: &DateTime<Tz>, tz: &Tz) -> () { // let offset = (current_tz_sec - val_tz_sec) * 1000 * 1000; // let mut ts = dt.timestamp_micros(); // ts += offset; // // TODO: need support timestamp_micros in chrono-0.4.22/src/offset/mod.rs // // use like tz.timestamp_nanos() // let (mut secs, mut micros) = (ts / 1_000_000, ts % 1_000_000); // if ts < 0 { // secs -= 1; // micros += 1_000_000; // } // Ok(tz.timestamp_opt(secs, (micros as u32) * 1000).unwrap()) // } impl<T> BufferReadDateTimeExt for Cursor<T> where T: AsRef<[u8]> { fn read_date_text(&mut self, tz: &Tz) -> Result<NaiveDate> { // TODO support YYYYMMDD format self.read_timestamp_text(tz) .map(|dt| dt.naive_local().date()) } fn read_timestamp_text(&mut self, tz: &Tz) -> Result<DateTime<Tz>> { // Date Part YYYY-MM-DD let mut buf = vec![0; DATE_LEN]; self.read_exact(buf.as_mut_slice())?; let mut v = std::str::from_utf8(buf.as_slice()) .map_err_to_code(ErrorCode::BadBytes, || { format!("Cannot convert value:{:?} to utf8", buf) })?; // convert zero date to `1970-01-01` if v == "0000-00-00" { v = "1970-01-01"; } let d = v .parse::<NaiveDate>() .map_err_to_code(ErrorCode::BadBytes, || { format!("Cannot parse value:{} to Date type", v) })?; let mut dt = tz .from_local_datetime(&d.and_hms_opt(0, 0, 0).unwrap()) .unwrap(); let less_1000 = |dt: DateTime<Tz>| { // convert timestamp less than `1000-01-01 00:00:00` to `1000-01-01 00:00:00` if dt.year() < 1000 { Ok(tz.from_utc_datetime( &NaiveDate::from_ymd_opt(1000, 1, 1) .unwrap() .and_hms_opt(0, 0, 0) .unwrap(), )) } else { Ok(dt) } }; // Time Part buf.clear(); if self.ignore(|b| b == b' ' || b == b'T') { // HH:mm:ss let mut buf = Vec::with_capacity(2); let mut times = Vec::with_capacity(3); loop { buf.clear(); let size = self.keep_read(&mut buf, |f| f.is_ascii_digit()); if size == 0 { break; } else { let time = parse_time_part(&buf, size)?; times.push(time); if times.len() == 3 { break; } self.ignore_byte(b':'); } } // Time part is HH:MM or HH or empty // Examples: '2022-02-02T', '2022-02-02 ', '2022-02-02T02', '2022-02-02T3:', '2022-02-03T03:13', '2022-02-03T03:13:' if times.len() < 3 { times.resize(3, 0); dt = tz .from_local_datetime(&d.and_hms_opt(times[0], times[1], times[2]).unwrap()) .unwrap(); return less_1000(dt); } dt = tz .from_local_datetime(&d.and_hms_opt(times[0], times[1], times[2]).unwrap()) .unwrap(); // ms .microseconds let dt = if self.ignore_byte(b'.') { buf.clear(); let size = self.keep_read(&mut buf, |f| f.is_ascii_digit()); if size == 0 { return Err(ErrorCode::BadBytes( "err with parse micros second, format like this:[.123456]", )); } let scales: i64 = lexical_core::FromLexical::from_lexical(buf.as_slice()).unwrap(); if size >= 9 { dt.checked_add_signed(Duration::nanoseconds(scales)) .unwrap() } else if size >= 6 { dt.checked_add_signed(Duration::microseconds(scales)) .unwrap() } else if size >= 3 { dt.checked_add_signed(Duration::milliseconds(scales)) .unwrap() } else { dt } } else { dt }; // Timezone 2022-02-02T03:00:03.123[z/Z[+/-08:00]] buf.clear(); let calc_offset = |current_tz_sec: i64, val_tz_sec: i64, dt: &DateTime<Tz>| { let offset = (current_tz_sec - val_tz_sec) * 1000 * 1000; let mut ts = dt.timestamp_micros(); ts += offset; // TODO: need support timestamp_micros in chrono-0.4.22/src/offset/mod.rs // use like tz.timestamp_nanos() let (mut secs, mut micros) = (ts / 1_000_000, ts % 1_000_000); if ts < 0 { secs -= 1; micros += 1_000_000; } Ok(tz.timestamp_opt(secs, (micros as u32) * 1000).unwrap()) }; if self.ignore(|b| b == b'z' || b == b'Z') { // ISO 8601 The Z on the end means UTC (that is, an offset-from-UTC of zero hours-minutes-seconds). if dt.year() < 1000 { Ok(tz.from_utc_datetime( &NaiveDate::from_ymd_opt(1000, 1, 1) .unwrap() .and_hms_opt(0, 0, 0) .unwrap(), )) } else { let current_tz = dt.offset().fix().local_minus_utc(); calc_offset(current_tz.into(), 0, &dt) } } else if self.ignore_byte(b'+') { self.parse_time_offset(tz, &mut buf, &dt, false, calc_offset) } else if self.ignore_byte(b'-') { self.parse_time_offset(tz, &mut buf, &dt, true, calc_offset) } else { // only datetime part less_1000(dt) } } else { // only date part less_1000(dt) } } // Only support HH:mm format fn parse_time_offset( &mut self, tz: &Tz, buf: &mut Vec<u8>, dt: &DateTime<Tz>, west_tz: bool, calc_offset: impl Fn(i64, i64, &DateTime<Tz>) -> Result<DateTime<Tz>>, ) -> Result<DateTime<Tz>> { let n = self.keep_read(buf, |f| f.is_ascii_digit()); if n != 2 { // +0800 will err in there return Err(ErrorCode::BadBytes( "err with parse timezone, format like this:[+08:00]", )); } let hour_offset: i32 = lexical_core::FromLexical::from_lexical(buf.as_slice()).unwrap(); if (0..15).contains(&hour_offset) { buf.clear(); self.ignore_byte(b':'); if self.keep_read(buf, |f| f.is_ascii_digit()) != 2 { // +08[other byte]00 will err in there, e.g. +08-00 return Err(ErrorCode::BadBytes( "err with parse timezone, format like this:[+08:00]", )); } let minute_offset: i32 = lexical_core::FromLexical::from_lexical(buf.as_slice()).unwrap(); // max utc: 14:00, min utc: 00:00 if (hour_offset == 14 && minute_offset == 0) || ((0..60).contains(&minute_offset) && hour_offset < 14) { if dt.year() < 1970 { Ok(tz.from_utc_datetime( &NaiveDate::from_ymd_opt(1970, 1, 1) .unwrap() .and_hms_opt(0, 0, 0) .unwrap(), )) } else { let current_tz_sec = dt.offset().fix().local_minus_utc(); let mut val_tz_sec = FixedOffset::east_opt(hour_offset * 3600 + minute_offset * 60) .unwrap() .local_minus_utc(); if west_tz { val_tz_sec = -val_tz_sec; } calc_offset(current_tz_sec.into(), val_tz_sec.into(), dt) } } else { Err(ErrorCode::BadBytes(format!( "err with parse minute_offset:[{:?}], timezone gap: [-14:00,+14:00]", minute_offset ))) } } else { Err(ErrorCode::BadBytes(format!( "err with parse hour_offset:[{:?}], timezone gap: [-14:00,+14:00]", hour_offset ))) } } }
fn main() { windows::core::build! { Component::Async::*, }; }
mod static_kv; use static_kv::{static_kv::static_kv, read_func::read_func}; fn main() { static_kv(); read_func(); println!("Hello, world!"); }
mod bing_maps; mod clean; mod cooccurrence; mod geo_coord; mod scrape; use clap::Parser; use std::process::ExitCode; #[derive(Parser, Clone)] #[clap(author, version, about, long_about = None)] enum Cli { Scrape { #[clap(flatten)] args: scrape::ScrapeArgs, }, Clean { #[clap(flatten)] args: clean::CleanArgs, }, Cooccurrence { #[clap(flatten)] args: cooccurrence::CoocurrenceArgs, }, } #[tokio::main] async fn main() -> ExitCode { let cli = Cli::parse(); if let Err(e) = match cli { Cli::Scrape { args } => scrape::scrape(args).await, Cli::Clean { args } => clean::clean(args).await, Cli::Cooccurrence { args } => cooccurrence::cooccurrence(args).await, } { eprintln!("{}", e); ExitCode::FAILURE } else { ExitCode::SUCCESS } }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qimagereader.h // dst-file: /src/gui/qimagereader.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= main block end // use block begin => use std::ops::Deref; use super::super::core::qstring::*; // 771 use super::super::core::qsize::*; // 771 use super::qimage::*; // 773 use super::super::core::qrect::*; // 771 use super::super::core::qstringlist::*; // 771 use super::super::core::qiodevice::*; // 771 use super::super::core::qbytearray::*; // 771 // use super::qlist::*; // 775 use super::qcolor::*; // 773 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QImageReader_Class_Size() -> c_int; // proto: QString QImageReader::errorString(); fn C_ZNK12QImageReader11errorStringEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QImageReader::canRead(); fn C_ZNK12QImageReader7canReadEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QImageReader::~QImageReader(); fn C_ZN12QImageReaderD2Ev(qthis: u64 /* *mut c_void*/); // proto: void QImageReader::setScaledSize(const QSize & size); fn C_ZN12QImageReader13setScaledSizeERK5QSize(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QImageReader::read(QImage * image); fn C_ZN12QImageReader4readEP6QImage(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: void QImageReader::setScaledClipRect(const QRect & rect); fn C_ZN12QImageReader17setScaledClipRectERK5QRect(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: int QImageReader::imageCount(); fn C_ZNK12QImageReader10imageCountEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QStringList QImageReader::textKeys(); fn C_ZNK12QImageReader8textKeysEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QImageReader::decideFormatFromContent(); fn C_ZNK12QImageReader23decideFormatFromContentEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QIODevice * QImageReader::device(); fn C_ZNK12QImageReader6deviceEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QImageReader::autoTransform(); fn C_ZNK12QImageReader13autoTransformEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QImageReader::jumpToNextImage(); fn C_ZN12QImageReader15jumpToNextImageEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: static QByteArray QImageReader::imageFormat(const QString & fileName); fn C_ZN12QImageReader11imageFormatERK7QString(arg0: *mut c_void) -> *mut c_void; // proto: QList<QByteArray> QImageReader::supportedSubTypes(); fn C_ZNK12QImageReader17supportedSubTypesEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QSize QImageReader::size(); fn C_ZNK12QImageReader4sizeEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QColor QImageReader::backgroundColor(); fn C_ZNK12QImageReader15backgroundColorEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QByteArray QImageReader::subType(); fn C_ZNK12QImageReader7subTypeEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QImageReader::currentImageNumber(); fn C_ZNK12QImageReader18currentImageNumberEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: static QList<QByteArray> QImageReader::supportedImageFormats(); fn C_ZN12QImageReader21supportedImageFormatsEv() -> *mut c_void; // proto: int QImageReader::loopCount(); fn C_ZNK12QImageReader9loopCountEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QImageReader::setDecideFormatFromContent(bool ignored); fn C_ZN12QImageReader26setDecideFormatFromContentEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: QRect QImageReader::scaledClipRect(); fn C_ZNK12QImageReader14scaledClipRectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: static QList<QByteArray> QImageReader::supportedMimeTypes(); fn C_ZN12QImageReader18supportedMimeTypesEv() -> *mut c_void; // proto: QString QImageReader::text(const QString & key); fn C_ZNK12QImageReader4textERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: int QImageReader::nextImageDelay(); fn C_ZNK12QImageReader14nextImageDelayEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QImage QImageReader::read(); fn C_ZN12QImageReader4readEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QImageReader::supportsAnimation(); fn C_ZNK12QImageReader17supportsAnimationEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QImageReader::jumpToImage(int imageNumber); fn C_ZN12QImageReader11jumpToImageEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_char; // proto: void QImageReader::setFileName(const QString & fileName); fn C_ZN12QImageReader11setFileNameERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QSize QImageReader::scaledSize(); fn C_ZNK12QImageReader10scaledSizeEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QImageReader::setAutoTransform(bool enabled); fn C_ZN12QImageReader16setAutoTransformEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QImageReader::setClipRect(const QRect & rect); fn C_ZN12QImageReader11setClipRectERK5QRect(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QImageReader::autoDetectImageFormat(); fn C_ZNK12QImageReader21autoDetectImageFormatEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QRect QImageReader::currentImageRect(); fn C_ZNK12QImageReader16currentImageRectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QImageReader::QImageReader(const QString & fileName, const QByteArray & format); fn C_ZN12QImageReaderC2ERK7QStringRK10QByteArray(arg0: *mut c_void, arg1: *mut c_void) -> u64; // proto: static QByteArray QImageReader::imageFormat(QIODevice * device); fn C_ZN12QImageReader11imageFormatEP9QIODevice(arg0: *mut c_void) -> *mut c_void; // proto: int QImageReader::quality(); fn C_ZNK12QImageReader7qualityEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QImageReader::setDevice(QIODevice * device); fn C_ZN12QImageReader9setDeviceEP9QIODevice(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QImageReader::setBackgroundColor(const QColor & color); fn C_ZN12QImageReader18setBackgroundColorERK6QColor(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QImageReader::setQuality(int quality); fn C_ZN12QImageReader10setQualityEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QImageReader::QImageReader(QIODevice * device, const QByteArray & format); fn C_ZN12QImageReaderC2EP9QIODeviceRK10QByteArray(arg0: *mut c_void, arg1: *mut c_void) -> u64; // proto: void QImageReader::setAutoDetectImageFormat(bool enabled); fn C_ZN12QImageReader24setAutoDetectImageFormatEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QImageReader::QImageReader(); fn C_ZN12QImageReaderC2Ev() -> u64; // proto: void QImageReader::setFormat(const QByteArray & format); fn C_ZN12QImageReader9setFormatERK10QByteArray(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QImageReader::fileName(); fn C_ZNK12QImageReader8fileNameEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QRect QImageReader::clipRect(); fn C_ZNK12QImageReader8clipRectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QByteArray QImageReader::format(); fn C_ZNK12QImageReader6formatEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; } // <= ext block end // body block begin => // class sizeof(QImageReader)=8 #[derive(Default)] pub struct QImageReader { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } impl /*struct*/ QImageReader { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QImageReader { return QImageReader{qclsinst: qthis, ..Default::default()}; } } // proto: QString QImageReader::errorString(); impl /*struct*/ QImageReader { pub fn errorString<RetType, T: QImageReader_errorString<RetType>>(& self, overload_args: T) -> RetType { return overload_args.errorString(self); // return 1; } } pub trait QImageReader_errorString<RetType> { fn errorString(self , rsthis: & QImageReader) -> RetType; } // proto: QString QImageReader::errorString(); impl<'a> /*trait*/ QImageReader_errorString<QString> for () { fn errorString(self , rsthis: & QImageReader) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader11errorStringEv()}; let mut ret = unsafe {C_ZNK12QImageReader11errorStringEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QImageReader::canRead(); impl /*struct*/ QImageReader { pub fn canRead<RetType, T: QImageReader_canRead<RetType>>(& self, overload_args: T) -> RetType { return overload_args.canRead(self); // return 1; } } pub trait QImageReader_canRead<RetType> { fn canRead(self , rsthis: & QImageReader) -> RetType; } // proto: bool QImageReader::canRead(); impl<'a> /*trait*/ QImageReader_canRead<i8> for () { fn canRead(self , rsthis: & QImageReader) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader7canReadEv()}; let mut ret = unsafe {C_ZNK12QImageReader7canReadEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QImageReader::~QImageReader(); impl /*struct*/ QImageReader { pub fn free<RetType, T: QImageReader_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QImageReader_free<RetType> { fn free(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::~QImageReader(); impl<'a> /*trait*/ QImageReader_free<()> for () { fn free(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReaderD2Ev()}; unsafe {C_ZN12QImageReaderD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: void QImageReader::setScaledSize(const QSize & size); impl /*struct*/ QImageReader { pub fn setScaledSize<RetType, T: QImageReader_setScaledSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setScaledSize(self); // return 1; } } pub trait QImageReader_setScaledSize<RetType> { fn setScaledSize(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setScaledSize(const QSize & size); impl<'a> /*trait*/ QImageReader_setScaledSize<()> for (&'a QSize) { fn setScaledSize(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader13setScaledSizeERK5QSize()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN12QImageReader13setScaledSizeERK5QSize(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QImageReader::read(QImage * image); impl /*struct*/ QImageReader { pub fn read<RetType, T: QImageReader_read<RetType>>(& self, overload_args: T) -> RetType { return overload_args.read(self); // return 1; } } pub trait QImageReader_read<RetType> { fn read(self , rsthis: & QImageReader) -> RetType; } // proto: bool QImageReader::read(QImage * image); impl<'a> /*trait*/ QImageReader_read<i8> for (&'a QImage) { fn read(self , rsthis: & QImageReader) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader4readEP6QImage()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN12QImageReader4readEP6QImage(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: void QImageReader::setScaledClipRect(const QRect & rect); impl /*struct*/ QImageReader { pub fn setScaledClipRect<RetType, T: QImageReader_setScaledClipRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setScaledClipRect(self); // return 1; } } pub trait QImageReader_setScaledClipRect<RetType> { fn setScaledClipRect(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setScaledClipRect(const QRect & rect); impl<'a> /*trait*/ QImageReader_setScaledClipRect<()> for (&'a QRect) { fn setScaledClipRect(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader17setScaledClipRectERK5QRect()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN12QImageReader17setScaledClipRectERK5QRect(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QImageReader::imageCount(); impl /*struct*/ QImageReader { pub fn imageCount<RetType, T: QImageReader_imageCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.imageCount(self); // return 1; } } pub trait QImageReader_imageCount<RetType> { fn imageCount(self , rsthis: & QImageReader) -> RetType; } // proto: int QImageReader::imageCount(); impl<'a> /*trait*/ QImageReader_imageCount<i32> for () { fn imageCount(self , rsthis: & QImageReader) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader10imageCountEv()}; let mut ret = unsafe {C_ZNK12QImageReader10imageCountEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QStringList QImageReader::textKeys(); impl /*struct*/ QImageReader { pub fn textKeys<RetType, T: QImageReader_textKeys<RetType>>(& self, overload_args: T) -> RetType { return overload_args.textKeys(self); // return 1; } } pub trait QImageReader_textKeys<RetType> { fn textKeys(self , rsthis: & QImageReader) -> RetType; } // proto: QStringList QImageReader::textKeys(); impl<'a> /*trait*/ QImageReader_textKeys<QStringList> for () { fn textKeys(self , rsthis: & QImageReader) -> QStringList { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader8textKeysEv()}; let mut ret = unsafe {C_ZNK12QImageReader8textKeysEv(rsthis.qclsinst)}; let mut ret1 = QStringList::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QImageReader::decideFormatFromContent(); impl /*struct*/ QImageReader { pub fn decideFormatFromContent<RetType, T: QImageReader_decideFormatFromContent<RetType>>(& self, overload_args: T) -> RetType { return overload_args.decideFormatFromContent(self); // return 1; } } pub trait QImageReader_decideFormatFromContent<RetType> { fn decideFormatFromContent(self , rsthis: & QImageReader) -> RetType; } // proto: bool QImageReader::decideFormatFromContent(); impl<'a> /*trait*/ QImageReader_decideFormatFromContent<i8> for () { fn decideFormatFromContent(self , rsthis: & QImageReader) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader23decideFormatFromContentEv()}; let mut ret = unsafe {C_ZNK12QImageReader23decideFormatFromContentEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QIODevice * QImageReader::device(); impl /*struct*/ QImageReader { pub fn device<RetType, T: QImageReader_device<RetType>>(& self, overload_args: T) -> RetType { return overload_args.device(self); // return 1; } } pub trait QImageReader_device<RetType> { fn device(self , rsthis: & QImageReader) -> RetType; } // proto: QIODevice * QImageReader::device(); impl<'a> /*trait*/ QImageReader_device<QIODevice> for () { fn device(self , rsthis: & QImageReader) -> QIODevice { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader6deviceEv()}; let mut ret = unsafe {C_ZNK12QImageReader6deviceEv(rsthis.qclsinst)}; let mut ret1 = QIODevice::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QImageReader::autoTransform(); impl /*struct*/ QImageReader { pub fn autoTransform<RetType, T: QImageReader_autoTransform<RetType>>(& self, overload_args: T) -> RetType { return overload_args.autoTransform(self); // return 1; } } pub trait QImageReader_autoTransform<RetType> { fn autoTransform(self , rsthis: & QImageReader) -> RetType; } // proto: bool QImageReader::autoTransform(); impl<'a> /*trait*/ QImageReader_autoTransform<i8> for () { fn autoTransform(self , rsthis: & QImageReader) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader13autoTransformEv()}; let mut ret = unsafe {C_ZNK12QImageReader13autoTransformEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QImageReader::jumpToNextImage(); impl /*struct*/ QImageReader { pub fn jumpToNextImage<RetType, T: QImageReader_jumpToNextImage<RetType>>(& self, overload_args: T) -> RetType { return overload_args.jumpToNextImage(self); // return 1; } } pub trait QImageReader_jumpToNextImage<RetType> { fn jumpToNextImage(self , rsthis: & QImageReader) -> RetType; } // proto: bool QImageReader::jumpToNextImage(); impl<'a> /*trait*/ QImageReader_jumpToNextImage<i8> for () { fn jumpToNextImage(self , rsthis: & QImageReader) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader15jumpToNextImageEv()}; let mut ret = unsafe {C_ZN12QImageReader15jumpToNextImageEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: static QByteArray QImageReader::imageFormat(const QString & fileName); impl /*struct*/ QImageReader { pub fn imageFormat_s<RetType, T: QImageReader_imageFormat_s<RetType>>( overload_args: T) -> RetType { return overload_args.imageFormat_s(); // return 1; } } pub trait QImageReader_imageFormat_s<RetType> { fn imageFormat_s(self ) -> RetType; } // proto: static QByteArray QImageReader::imageFormat(const QString & fileName); impl<'a> /*trait*/ QImageReader_imageFormat_s<QByteArray> for (&'a QString) { fn imageFormat_s(self ) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader11imageFormatERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN12QImageReader11imageFormatERK7QString(arg0)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QList<QByteArray> QImageReader::supportedSubTypes(); impl /*struct*/ QImageReader { pub fn supportedSubTypes<RetType, T: QImageReader_supportedSubTypes<RetType>>(& self, overload_args: T) -> RetType { return overload_args.supportedSubTypes(self); // return 1; } } pub trait QImageReader_supportedSubTypes<RetType> { fn supportedSubTypes(self , rsthis: & QImageReader) -> RetType; } // proto: QList<QByteArray> QImageReader::supportedSubTypes(); impl<'a> /*trait*/ QImageReader_supportedSubTypes<u64> for () { fn supportedSubTypes(self , rsthis: & QImageReader) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader17supportedSubTypesEv()}; let mut ret = unsafe {C_ZNK12QImageReader17supportedSubTypesEv(rsthis.qclsinst)}; return ret as u64; // 5 // return 1; } } // proto: QSize QImageReader::size(); impl /*struct*/ QImageReader { pub fn size<RetType, T: QImageReader_size<RetType>>(& self, overload_args: T) -> RetType { return overload_args.size(self); // return 1; } } pub trait QImageReader_size<RetType> { fn size(self , rsthis: & QImageReader) -> RetType; } // proto: QSize QImageReader::size(); impl<'a> /*trait*/ QImageReader_size<QSize> for () { fn size(self , rsthis: & QImageReader) -> QSize { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader4sizeEv()}; let mut ret = unsafe {C_ZNK12QImageReader4sizeEv(rsthis.qclsinst)}; let mut ret1 = QSize::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QColor QImageReader::backgroundColor(); impl /*struct*/ QImageReader { pub fn backgroundColor<RetType, T: QImageReader_backgroundColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.backgroundColor(self); // return 1; } } pub trait QImageReader_backgroundColor<RetType> { fn backgroundColor(self , rsthis: & QImageReader) -> RetType; } // proto: QColor QImageReader::backgroundColor(); impl<'a> /*trait*/ QImageReader_backgroundColor<QColor> for () { fn backgroundColor(self , rsthis: & QImageReader) -> QColor { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader15backgroundColorEv()}; let mut ret = unsafe {C_ZNK12QImageReader15backgroundColorEv(rsthis.qclsinst)}; let mut ret1 = QColor::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QByteArray QImageReader::subType(); impl /*struct*/ QImageReader { pub fn subType<RetType, T: QImageReader_subType<RetType>>(& self, overload_args: T) -> RetType { return overload_args.subType(self); // return 1; } } pub trait QImageReader_subType<RetType> { fn subType(self , rsthis: & QImageReader) -> RetType; } // proto: QByteArray QImageReader::subType(); impl<'a> /*trait*/ QImageReader_subType<QByteArray> for () { fn subType(self , rsthis: & QImageReader) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader7subTypeEv()}; let mut ret = unsafe {C_ZNK12QImageReader7subTypeEv(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QImageReader::currentImageNumber(); impl /*struct*/ QImageReader { pub fn currentImageNumber<RetType, T: QImageReader_currentImageNumber<RetType>>(& self, overload_args: T) -> RetType { return overload_args.currentImageNumber(self); // return 1; } } pub trait QImageReader_currentImageNumber<RetType> { fn currentImageNumber(self , rsthis: & QImageReader) -> RetType; } // proto: int QImageReader::currentImageNumber(); impl<'a> /*trait*/ QImageReader_currentImageNumber<i32> for () { fn currentImageNumber(self , rsthis: & QImageReader) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader18currentImageNumberEv()}; let mut ret = unsafe {C_ZNK12QImageReader18currentImageNumberEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: static QList<QByteArray> QImageReader::supportedImageFormats(); impl /*struct*/ QImageReader { pub fn supportedImageFormats_s<RetType, T: QImageReader_supportedImageFormats_s<RetType>>( overload_args: T) -> RetType { return overload_args.supportedImageFormats_s(); // return 1; } } pub trait QImageReader_supportedImageFormats_s<RetType> { fn supportedImageFormats_s(self ) -> RetType; } // proto: static QList<QByteArray> QImageReader::supportedImageFormats(); impl<'a> /*trait*/ QImageReader_supportedImageFormats_s<u64> for () { fn supportedImageFormats_s(self ) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader21supportedImageFormatsEv()}; let mut ret = unsafe {C_ZN12QImageReader21supportedImageFormatsEv()}; return ret as u64; // 5 // return 1; } } // proto: int QImageReader::loopCount(); impl /*struct*/ QImageReader { pub fn loopCount<RetType, T: QImageReader_loopCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.loopCount(self); // return 1; } } pub trait QImageReader_loopCount<RetType> { fn loopCount(self , rsthis: & QImageReader) -> RetType; } // proto: int QImageReader::loopCount(); impl<'a> /*trait*/ QImageReader_loopCount<i32> for () { fn loopCount(self , rsthis: & QImageReader) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader9loopCountEv()}; let mut ret = unsafe {C_ZNK12QImageReader9loopCountEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QImageReader::setDecideFormatFromContent(bool ignored); impl /*struct*/ QImageReader { pub fn setDecideFormatFromContent<RetType, T: QImageReader_setDecideFormatFromContent<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setDecideFormatFromContent(self); // return 1; } } pub trait QImageReader_setDecideFormatFromContent<RetType> { fn setDecideFormatFromContent(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setDecideFormatFromContent(bool ignored); impl<'a> /*trait*/ QImageReader_setDecideFormatFromContent<()> for (i8) { fn setDecideFormatFromContent(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader26setDecideFormatFromContentEb()}; let arg0 = self as c_char; unsafe {C_ZN12QImageReader26setDecideFormatFromContentEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QRect QImageReader::scaledClipRect(); impl /*struct*/ QImageReader { pub fn scaledClipRect<RetType, T: QImageReader_scaledClipRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.scaledClipRect(self); // return 1; } } pub trait QImageReader_scaledClipRect<RetType> { fn scaledClipRect(self , rsthis: & QImageReader) -> RetType; } // proto: QRect QImageReader::scaledClipRect(); impl<'a> /*trait*/ QImageReader_scaledClipRect<QRect> for () { fn scaledClipRect(self , rsthis: & QImageReader) -> QRect { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader14scaledClipRectEv()}; let mut ret = unsafe {C_ZNK12QImageReader14scaledClipRectEv(rsthis.qclsinst)}; let mut ret1 = QRect::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QList<QByteArray> QImageReader::supportedMimeTypes(); impl /*struct*/ QImageReader { pub fn supportedMimeTypes_s<RetType, T: QImageReader_supportedMimeTypes_s<RetType>>( overload_args: T) -> RetType { return overload_args.supportedMimeTypes_s(); // return 1; } } pub trait QImageReader_supportedMimeTypes_s<RetType> { fn supportedMimeTypes_s(self ) -> RetType; } // proto: static QList<QByteArray> QImageReader::supportedMimeTypes(); impl<'a> /*trait*/ QImageReader_supportedMimeTypes_s<u64> for () { fn supportedMimeTypes_s(self ) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader18supportedMimeTypesEv()}; let mut ret = unsafe {C_ZN12QImageReader18supportedMimeTypesEv()}; return ret as u64; // 5 // return 1; } } // proto: QString QImageReader::text(const QString & key); impl /*struct*/ QImageReader { pub fn text<RetType, T: QImageReader_text<RetType>>(& self, overload_args: T) -> RetType { return overload_args.text(self); // return 1; } } pub trait QImageReader_text<RetType> { fn text(self , rsthis: & QImageReader) -> RetType; } // proto: QString QImageReader::text(const QString & key); impl<'a> /*trait*/ QImageReader_text<QString> for (&'a QString) { fn text(self , rsthis: & QImageReader) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader4textERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK12QImageReader4textERK7QString(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QImageReader::nextImageDelay(); impl /*struct*/ QImageReader { pub fn nextImageDelay<RetType, T: QImageReader_nextImageDelay<RetType>>(& self, overload_args: T) -> RetType { return overload_args.nextImageDelay(self); // return 1; } } pub trait QImageReader_nextImageDelay<RetType> { fn nextImageDelay(self , rsthis: & QImageReader) -> RetType; } // proto: int QImageReader::nextImageDelay(); impl<'a> /*trait*/ QImageReader_nextImageDelay<i32> for () { fn nextImageDelay(self , rsthis: & QImageReader) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader14nextImageDelayEv()}; let mut ret = unsafe {C_ZNK12QImageReader14nextImageDelayEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QImage QImageReader::read(); impl<'a> /*trait*/ QImageReader_read<QImage> for () { fn read(self , rsthis: & QImageReader) -> QImage { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader4readEv()}; let mut ret = unsafe {C_ZN12QImageReader4readEv(rsthis.qclsinst)}; let mut ret1 = QImage::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QImageReader::supportsAnimation(); impl /*struct*/ QImageReader { pub fn supportsAnimation<RetType, T: QImageReader_supportsAnimation<RetType>>(& self, overload_args: T) -> RetType { return overload_args.supportsAnimation(self); // return 1; } } pub trait QImageReader_supportsAnimation<RetType> { fn supportsAnimation(self , rsthis: & QImageReader) -> RetType; } // proto: bool QImageReader::supportsAnimation(); impl<'a> /*trait*/ QImageReader_supportsAnimation<i8> for () { fn supportsAnimation(self , rsthis: & QImageReader) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader17supportsAnimationEv()}; let mut ret = unsafe {C_ZNK12QImageReader17supportsAnimationEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QImageReader::jumpToImage(int imageNumber); impl /*struct*/ QImageReader { pub fn jumpToImage<RetType, T: QImageReader_jumpToImage<RetType>>(& self, overload_args: T) -> RetType { return overload_args.jumpToImage(self); // return 1; } } pub trait QImageReader_jumpToImage<RetType> { fn jumpToImage(self , rsthis: & QImageReader) -> RetType; } // proto: bool QImageReader::jumpToImage(int imageNumber); impl<'a> /*trait*/ QImageReader_jumpToImage<i8> for (i32) { fn jumpToImage(self , rsthis: & QImageReader) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader11jumpToImageEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZN12QImageReader11jumpToImageEi(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: void QImageReader::setFileName(const QString & fileName); impl /*struct*/ QImageReader { pub fn setFileName<RetType, T: QImageReader_setFileName<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFileName(self); // return 1; } } pub trait QImageReader_setFileName<RetType> { fn setFileName(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setFileName(const QString & fileName); impl<'a> /*trait*/ QImageReader_setFileName<()> for (&'a QString) { fn setFileName(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader11setFileNameERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN12QImageReader11setFileNameERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QSize QImageReader::scaledSize(); impl /*struct*/ QImageReader { pub fn scaledSize<RetType, T: QImageReader_scaledSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.scaledSize(self); // return 1; } } pub trait QImageReader_scaledSize<RetType> { fn scaledSize(self , rsthis: & QImageReader) -> RetType; } // proto: QSize QImageReader::scaledSize(); impl<'a> /*trait*/ QImageReader_scaledSize<QSize> for () { fn scaledSize(self , rsthis: & QImageReader) -> QSize { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader10scaledSizeEv()}; let mut ret = unsafe {C_ZNK12QImageReader10scaledSizeEv(rsthis.qclsinst)}; let mut ret1 = QSize::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QImageReader::setAutoTransform(bool enabled); impl /*struct*/ QImageReader { pub fn setAutoTransform<RetType, T: QImageReader_setAutoTransform<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setAutoTransform(self); // return 1; } } pub trait QImageReader_setAutoTransform<RetType> { fn setAutoTransform(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setAutoTransform(bool enabled); impl<'a> /*trait*/ QImageReader_setAutoTransform<()> for (i8) { fn setAutoTransform(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader16setAutoTransformEb()}; let arg0 = self as c_char; unsafe {C_ZN12QImageReader16setAutoTransformEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QImageReader::setClipRect(const QRect & rect); impl /*struct*/ QImageReader { pub fn setClipRect<RetType, T: QImageReader_setClipRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setClipRect(self); // return 1; } } pub trait QImageReader_setClipRect<RetType> { fn setClipRect(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setClipRect(const QRect & rect); impl<'a> /*trait*/ QImageReader_setClipRect<()> for (&'a QRect) { fn setClipRect(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader11setClipRectERK5QRect()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN12QImageReader11setClipRectERK5QRect(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QImageReader::autoDetectImageFormat(); impl /*struct*/ QImageReader { pub fn autoDetectImageFormat<RetType, T: QImageReader_autoDetectImageFormat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.autoDetectImageFormat(self); // return 1; } } pub trait QImageReader_autoDetectImageFormat<RetType> { fn autoDetectImageFormat(self , rsthis: & QImageReader) -> RetType; } // proto: bool QImageReader::autoDetectImageFormat(); impl<'a> /*trait*/ QImageReader_autoDetectImageFormat<i8> for () { fn autoDetectImageFormat(self , rsthis: & QImageReader) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader21autoDetectImageFormatEv()}; let mut ret = unsafe {C_ZNK12QImageReader21autoDetectImageFormatEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QRect QImageReader::currentImageRect(); impl /*struct*/ QImageReader { pub fn currentImageRect<RetType, T: QImageReader_currentImageRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.currentImageRect(self); // return 1; } } pub trait QImageReader_currentImageRect<RetType> { fn currentImageRect(self , rsthis: & QImageReader) -> RetType; } // proto: QRect QImageReader::currentImageRect(); impl<'a> /*trait*/ QImageReader_currentImageRect<QRect> for () { fn currentImageRect(self , rsthis: & QImageReader) -> QRect { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader16currentImageRectEv()}; let mut ret = unsafe {C_ZNK12QImageReader16currentImageRectEv(rsthis.qclsinst)}; let mut ret1 = QRect::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QImageReader::QImageReader(const QString & fileName, const QByteArray & format); impl /*struct*/ QImageReader { pub fn new<T: QImageReader_new>(value: T) -> QImageReader { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QImageReader_new { fn new(self) -> QImageReader; } // proto: void QImageReader::QImageReader(const QString & fileName, const QByteArray & format); impl<'a> /*trait*/ QImageReader_new for (&'a QString, Option<&'a QByteArray>) { fn new(self) -> QImageReader { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReaderC2ERK7QStringRK10QByteArray()}; let ctysz: c_int = unsafe{QImageReader_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {QByteArray::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let qthis: u64 = unsafe {C_ZN12QImageReaderC2ERK7QStringRK10QByteArray(arg0, arg1)}; let rsthis = QImageReader{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: static QByteArray QImageReader::imageFormat(QIODevice * device); impl<'a> /*trait*/ QImageReader_imageFormat_s<QByteArray> for (&'a QIODevice) { fn imageFormat_s(self ) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader11imageFormatEP9QIODevice()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN12QImageReader11imageFormatEP9QIODevice(arg0)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QImageReader::quality(); impl /*struct*/ QImageReader { pub fn quality<RetType, T: QImageReader_quality<RetType>>(& self, overload_args: T) -> RetType { return overload_args.quality(self); // return 1; } } pub trait QImageReader_quality<RetType> { fn quality(self , rsthis: & QImageReader) -> RetType; } // proto: int QImageReader::quality(); impl<'a> /*trait*/ QImageReader_quality<i32> for () { fn quality(self , rsthis: & QImageReader) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader7qualityEv()}; let mut ret = unsafe {C_ZNK12QImageReader7qualityEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QImageReader::setDevice(QIODevice * device); impl /*struct*/ QImageReader { pub fn setDevice<RetType, T: QImageReader_setDevice<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setDevice(self); // return 1; } } pub trait QImageReader_setDevice<RetType> { fn setDevice(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setDevice(QIODevice * device); impl<'a> /*trait*/ QImageReader_setDevice<()> for (&'a QIODevice) { fn setDevice(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader9setDeviceEP9QIODevice()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN12QImageReader9setDeviceEP9QIODevice(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QImageReader::setBackgroundColor(const QColor & color); impl /*struct*/ QImageReader { pub fn setBackgroundColor<RetType, T: QImageReader_setBackgroundColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setBackgroundColor(self); // return 1; } } pub trait QImageReader_setBackgroundColor<RetType> { fn setBackgroundColor(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setBackgroundColor(const QColor & color); impl<'a> /*trait*/ QImageReader_setBackgroundColor<()> for (&'a QColor) { fn setBackgroundColor(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader18setBackgroundColorERK6QColor()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN12QImageReader18setBackgroundColorERK6QColor(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QImageReader::setQuality(int quality); impl /*struct*/ QImageReader { pub fn setQuality<RetType, T: QImageReader_setQuality<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setQuality(self); // return 1; } } pub trait QImageReader_setQuality<RetType> { fn setQuality(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setQuality(int quality); impl<'a> /*trait*/ QImageReader_setQuality<()> for (i32) { fn setQuality(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader10setQualityEi()}; let arg0 = self as c_int; unsafe {C_ZN12QImageReader10setQualityEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QImageReader::QImageReader(QIODevice * device, const QByteArray & format); impl<'a> /*trait*/ QImageReader_new for (&'a QIODevice, Option<&'a QByteArray>) { fn new(self) -> QImageReader { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReaderC2EP9QIODeviceRK10QByteArray()}; let ctysz: c_int = unsafe{QImageReader_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {QByteArray::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let qthis: u64 = unsafe {C_ZN12QImageReaderC2EP9QIODeviceRK10QByteArray(arg0, arg1)}; let rsthis = QImageReader{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QImageReader::setAutoDetectImageFormat(bool enabled); impl /*struct*/ QImageReader { pub fn setAutoDetectImageFormat<RetType, T: QImageReader_setAutoDetectImageFormat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setAutoDetectImageFormat(self); // return 1; } } pub trait QImageReader_setAutoDetectImageFormat<RetType> { fn setAutoDetectImageFormat(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setAutoDetectImageFormat(bool enabled); impl<'a> /*trait*/ QImageReader_setAutoDetectImageFormat<()> for (i8) { fn setAutoDetectImageFormat(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader24setAutoDetectImageFormatEb()}; let arg0 = self as c_char; unsafe {C_ZN12QImageReader24setAutoDetectImageFormatEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QImageReader::QImageReader(); impl<'a> /*trait*/ QImageReader_new for () { fn new(self) -> QImageReader { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReaderC2Ev()}; let ctysz: c_int = unsafe{QImageReader_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN12QImageReaderC2Ev()}; let rsthis = QImageReader{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QImageReader::setFormat(const QByteArray & format); impl /*struct*/ QImageReader { pub fn setFormat<RetType, T: QImageReader_setFormat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFormat(self); // return 1; } } pub trait QImageReader_setFormat<RetType> { fn setFormat(self , rsthis: & QImageReader) -> RetType; } // proto: void QImageReader::setFormat(const QByteArray & format); impl<'a> /*trait*/ QImageReader_setFormat<()> for (&'a QByteArray) { fn setFormat(self , rsthis: & QImageReader) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN12QImageReader9setFormatERK10QByteArray()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN12QImageReader9setFormatERK10QByteArray(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QImageReader::fileName(); impl /*struct*/ QImageReader { pub fn fileName<RetType, T: QImageReader_fileName<RetType>>(& self, overload_args: T) -> RetType { return overload_args.fileName(self); // return 1; } } pub trait QImageReader_fileName<RetType> { fn fileName(self , rsthis: & QImageReader) -> RetType; } // proto: QString QImageReader::fileName(); impl<'a> /*trait*/ QImageReader_fileName<QString> for () { fn fileName(self , rsthis: & QImageReader) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader8fileNameEv()}; let mut ret = unsafe {C_ZNK12QImageReader8fileNameEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QRect QImageReader::clipRect(); impl /*struct*/ QImageReader { pub fn clipRect<RetType, T: QImageReader_clipRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.clipRect(self); // return 1; } } pub trait QImageReader_clipRect<RetType> { fn clipRect(self , rsthis: & QImageReader) -> RetType; } // proto: QRect QImageReader::clipRect(); impl<'a> /*trait*/ QImageReader_clipRect<QRect> for () { fn clipRect(self , rsthis: & QImageReader) -> QRect { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader8clipRectEv()}; let mut ret = unsafe {C_ZNK12QImageReader8clipRectEv(rsthis.qclsinst)}; let mut ret1 = QRect::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QByteArray QImageReader::format(); impl /*struct*/ QImageReader { pub fn format<RetType, T: QImageReader_format<RetType>>(& self, overload_args: T) -> RetType { return overload_args.format(self); // return 1; } } pub trait QImageReader_format<RetType> { fn format(self , rsthis: & QImageReader) -> RetType; } // proto: QByteArray QImageReader::format(); impl<'a> /*trait*/ QImageReader_format<QByteArray> for () { fn format(self , rsthis: & QImageReader) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK12QImageReader6formatEv()}; let mut ret = unsafe {C_ZNK12QImageReader6formatEv(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // <= body block end
use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std::usize::MAX / 4; #[allow(unused)] const M: usize = 1000000007; fn main() { input! { n: usize, s: Chars, } for x in 0..4 { let mut answer = vec![' '; n]; for i in 0..2 { if x & 1 << i > 0 { answer[i] = 'S'; } else { answer[i] = 'W'; } } for i in 2..n { if (answer[i - 1] == 'S' && s[i - 1] == 'o') || (answer[i - 1] == 'W' && s[i - 1] == 'x') { answer[i] = answer[i - 2]; } else { if answer[i - 2] == 'S' { answer[i] = 'W'; } else { answer[i] = 'S'; } } } // eprintln!("{}", answer.iter().collect::<String>()); if (answer[0] == 'S' && s[0] == 'o') || (answer[0] == 'W' && s[0] == 'x') { if answer[1] != answer[n - 1] { continue; } } else { if answer[1] == answer[n - 1] { continue; } } if (answer[n - 1] == 'S' && s[n - 1] == 'o') || (answer[n - 1] == 'W' && s[n - 1] == 'x') { if answer[0] != answer[n - 2] { continue; } } else { if answer[0] == answer[n - 2] { continue; } } println!("{}", answer.iter().collect::<String>()); return; } println!("-1"); }
#![cfg(test)] use *; // Comparing floats with a relative allowed gap fn close_enough(a: f32, b: f32) -> bool { println!("Comparing '{}' and '{}'", a, b); (a - b).abs() <= 1.0e-06 * a.abs().max(b.abs()) } #[test] fn test_position() { assert_eq!(screen_pos_to_opengl_pos([500.0, 500.0], 1000.0, 1000.0), [0.0, 0.0]); assert_eq!(screen_pos_to_opengl_pos([0.0, 0.0], 1000.0, 1000.0), [-1.0, 1.0]); assert_eq!(screen_pos_to_opengl_pos([1000.0, 0.0], 1000.0, 1000.0), [1.0, 1.0]); assert_eq!(screen_pos_to_opengl_pos([0.0, 1000.0], 1000.0, 1000.0), [-1.0, -1.0]); assert_eq!(screen_pos_to_opengl_pos([1000.0, 1000.0], 1000.0, 1000.0), [1.0, -1.0]); assert_eq!(screen_pos_to_opengl_pos([750.0, 250.0], 1000.0, 1000.0), [0.5, 0.5]); } #[test] fn compile_shaders() { use glium::glutin::*; use glium::glutin::dpi::*; use glium::backend::glutin::headless::*; let context_builder = ContextBuilder::new(); let event_loop = EventsLoop::new(); let context = context_builder.build_headless(&event_loop, PhysicalSize::new(1000.0, 1000.0)).unwrap(); let display = Headless::new(context).unwrap(); default_program(&display).unwrap(); } #[test] fn test_vertex_gen() { use glium::glutin::*; use glium::glutin::dpi::*; use glium::backend::glutin::headless::*; let context_builder = ContextBuilder::new(); let event_loop = EventsLoop::new(); let context = context_builder.build_headless(&event_loop, PhysicalSize::new(1000.0, 1000.0)).unwrap(); let display = Headless::new(context).unwrap(); let mut font = CachedFont::from_bytes(include_bytes!("../examples/fonts/WenQuanYiMicroHei.ttf"), &display).unwrap(); // The HeadlessRendererBuilder dimensions != the framebuffer dimensions for whatever reason let (width, height) = display.framebuffer_dimensions(); let origin_a = [0.0, 0.0]; let origin_b = [100.0, 666.6]; let vertices_a: Vec<_> = font.get_vertices("Hello World", origin_a, 32.0, false, &display).unwrap().collect(); let vertices_b: Vec<_> = font.get_vertices("Hello World", origin_b, 32.0, false, &display).unwrap().collect(); let vertices_a_pixelated: Vec<_> = font.get_vertices("Hello World", origin_a, 32.0, true, &display).unwrap().collect(); let vertices_b_pixelated: Vec<_> = font.get_vertices("Hello World", origin_b, 32.0, true, &display).unwrap().collect(); // Get the difference in opengl coordinates between the two origins let origin_a = screen_pos_to_opengl_pos(origin_a, width as f32, height as f32); let origin_b = screen_pos_to_opengl_pos(origin_b, width as f32, height as f32); let delta = [ origin_b[0] - origin_a[0], origin_b[1] - origin_a[1] ]; // assert that the vertices plus the delta match, meaning that they are offset correctly for (a, b) in vertices_a.iter().zip(vertices_b.iter()) { println!("#####\n{:?}\n{:?}", a, b); assert!(close_enough(a.in_pos[0] + delta[0], b.in_pos[0])); assert!(close_enough(a.in_pos[1] + delta[1], b.in_pos[1])); } for (a, b) in vertices_a_pixelated.iter().zip(vertices_b_pixelated.iter()) { println!("#####\n{:?}\n{:?}", a, b); assert!(close_enough(a.in_pos[0] + delta[0], b.in_pos[0])); assert!(close_enough(a.in_pos[1] + delta[1], b.in_pos[1])); } }
#[derive(Copy, Clone)] pub enum Card { ClubsAce = 0x01, ClubsTwo = 0x02, ClubsThree = 0x03, ClubsFour = 0x04, ClubsFive = 0x05, ClubsSix = 0x06, ClubsSeven = 0x07, ClubsEight = 0x08, ClubsNine = 0x09, ClubsTen = 0x0A, ClubsJack = 0x0B, ClubsQueen = 0x0C, ClubsKing = 0x0D, DiamondsAce = 0x11, DiamondsTwo = 0x12, DiamondsThree = 0x13, DiamondsFour = 0x14, DiamondsFive = 0x15, DiamondsSix = 0x16, DiamondsSeven = 0x17, DiamondsEight = 0x18, DiamondsNine = 0x19, DiamondsTen = 0x1A, DiamondsJack = 0x1B, DiamondsQueen = 0x1C, DiamondsKing = 0x1D, HeartsAce = 0x21, HeartsTwo = 0x22, HeartsThree = 0x23, HeartsFour = 0x24, HeartsFive = 0x25, HeartsSix = 0x26, HeartsSeven = 0x27, HeartsEight = 0x28, HeartsNine = 0x29, HeartsTen = 0x2A, HeartsJack = 0x2B, HeartsQueen = 0x2C, HeartsKing = 0x2D, SpadesAce = 0x31, SpadesTwo = 0x32, SpadesThree = 0x33, SpadesFour = 0x34, SpadesFive = 0x35, SpadesSix = 0x36, SpadesSeven = 0x37, SpadesEight = 0x38, SpadesNine = 0x39, SpadesTen = 0x3A, SpadesJack = 0x3B, SpadesQueen = 0x3C, SpadesKing = 0x3D, } pub fn get_card_name(card: &Card) -> String { match card { Card::ClubsAce => String::from("ace of Clubs"), Card::ClubsTwo => String::from("two of Clubs"), Card::ClubsThree => String::from("three of Clubs"), Card::ClubsFour => String::from("four of Clubs"), Card::ClubsFive => String::from("five of Clubs"), Card::ClubsSix => String::from("six of Clubs"), Card::ClubsSeven => String::from("seven of Clubs"), Card::ClubsEight => String::from("eight of Clubs"), Card::ClubsNine => String::from("nine of Clubs"), Card::ClubsTen => String::from("ten of Clubs"), Card::ClubsJack => String::from("jack of Clubs"), Card::ClubsQueen => String::from("queen of Clubs"), Card::ClubsKing => String::from("king of Clubs"), Card::DiamondsAce => String::from("ace of Diamonds"), Card::DiamondsTwo => String::from("two of Diamonds"), Card::DiamondsThree => String::from("three of Diamonds"), Card::DiamondsFour => String::from("four of Diamonds"), Card::DiamondsFive => String::from("five of Diamonds"), Card::DiamondsSix => String::from("six of Diamonds"), Card::DiamondsSeven => String::from("seven of Diamonds"), Card::DiamondsEight => String::from("eight of Diamonds"), Card::DiamondsNine => String::from("nine of Diamonds"), Card::DiamondsTen => String::from("ten of Diamonds"), Card::DiamondsJack => String::from("jack of Diamonds"), Card::DiamondsQueen => String::from("queen of Diamonds"), Card::DiamondsKing => String::from("king of Diamonds"), Card::HeartsAce => String::from("ace of Hearts"), Card::HeartsTwo => String::from("two of Hearts"), Card::HeartsThree => String::from("three of Hearts"), Card::HeartsFour => String::from("four of Hearts"), Card::HeartsFive => String::from("five of Hearts"), Card::HeartsSix => String::from("six of Hearts"), Card::HeartsSeven => String::from("seven of Hearts"), Card::HeartsEight => String::from("eight of Hearts"), Card::HeartsNine => String::from("nine of Hearts"), Card::HeartsTen => String::from("ten of Hearts"), Card::HeartsJack => String::from("jack of Hearts"), Card::HeartsQueen => String::from("queen of Hearts"), Card::HeartsKing => String::from("king of Hearts"), Card::SpadesAce => String::from("ace of Spades"), Card::SpadesTwo => String::from("two of Spades"), Card::SpadesThree => String::from("three of Spades"), Card::SpadesFour => String::from("four of Spades"), Card::SpadesFive => String::from("five of Spades"), Card::SpadesSix => String::from("six of Spades"), Card::SpadesSeven => String::from("seven of Spades"), Card::SpadesEight => String::from("eight of Spades"), Card::SpadesNine => String::from("nine of Spades"), Card::SpadesTen => String::from("ten of Spades"), Card::SpadesJack => String::from("jack of Spades"), Card::SpadesQueen => String::from("queen of Spades"), Card::SpadesKing => String::from("king of Spades"), } } pub fn get_card_value(card: &Card) -> u8 { let unmask_card: u8 = 0x0f & *card as u8; if unmask_card > 10 { 10 } else { unmask_card } }
// 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::common::{KeyAttributes, KeyRequestType, KeyType, KmsKey}; use crate::crypto_provider::CryptoProvider; use crate::kms_asymmetric_key::KmsAsymmetricKey; use fidl::endpoints::ServerEnd; use fidl_fuchsia_kms::{ AsymmetricKeyAlgorithm, AsymmetricPrivateKeyMarker, KeyManagerRequest, KeyOrigin, Status, }; use fuchsia_async as fasync; use futures::prelude::*; use log::error; use serde_derive::{Deserialize, Serialize}; use std::collections::HashMap; use std::fs; use std::io::{Error, ErrorKind}; use std::path::{Path, PathBuf}; use std::str; use std::sync::{Arc, Mutex, RwLock}; const PROVIDER_NAME: &str = "MundaneSoftwareProvider"; const KEY_FOLDER: &str = "/data/kms"; #[derive(Serialize, Deserialize)] struct KeyAttributesJson { pub key_algorithm: u32, pub key_type: KeyType, pub key_origin: u32, pub provider_name: String, pub key_data: Vec<u8>, } /// Manages a key object map, delegates operation to key object and manages storage for key data. /// /// KeyManager manages a key_name -> key_object map and delegates operations to key objects. When a /// key creates, the key manager insert the key into the key map. When getting a key handle, the key /// manager return the key object from key map. When deleting a key, the key is removed from key map ///, note that the key object itself is still alive as long as the handle is still alive, however, /// the object would be mark deleted and any following request on that handle should return a /// failure. /// /// KeyManager also manages the storage for key data and key attributes. pub struct KeyManager { /// A map of key_name -> key_object. key_map: Arc<Mutex<HashMap<String, Arc<Mutex<dyn KmsKey>>>>>, /// All the available crypto providers. crypto_provider_map: RwLock<HashMap<&'static str, Box<dyn CryptoProvider>>>, /// The path to the key folder to store key data and attributes. key_folder: String, } impl KeyManager { pub fn new() -> Self { KeyManager { key_map: Arc::new(Mutex::new(HashMap::new())), crypto_provider_map: RwLock::new(HashMap::new()), key_folder: KEY_FOLDER.to_string(), } } #[allow(dead_code)] #[cfg(test)] pub fn set_key_folder(&mut self, key_folder: &str) { self.key_folder = key_folder.to_string(); } pub fn handle_request(&self, req: KeyManagerRequest) -> Result<(), fidl::Error> { match req { KeyManagerRequest::GenerateAsymmetricKey { key_name, key, responder } => { self.with_provider(PROVIDER_NAME, |provider| { // Default algorithm for asymmetric key is ECDSA-SHA512-P521. match self.generate_asymmetric_key_and_bind( &key_name, key, AsymmetricKeyAlgorithm::EcdsaSha512P521, provider.unwrap(), ) { Ok(()) => responder.send(Status::Ok), Err(status) => responder.send(status), } }) } KeyManagerRequest::GenerateAsymmetricKeyWithAlgorithm { key_name, key_algorithm, key, responder, } => { self.with_provider(PROVIDER_NAME, |provider| { match self.generate_asymmetric_key_and_bind( &key_name, key, key_algorithm, provider.unwrap(), ) { Ok(()) => responder.send(Status::Ok), Err(status) => responder.send(status), } }) } KeyManagerRequest::GetAsymmetricPrivateKey { key_name, key, responder } => { match self.get_asymmetric_private_key_and_bind(&key_name, key) { Ok(()) => responder.send(Status::Ok), Err(status) => responder.send(status), } } KeyManagerRequest::ImportAsymmetricPrivateKey { data, key_name, key_algorithm, key, responder, } => { self.with_provider(PROVIDER_NAME, |provider| {; match self.import_asymmetric_private_key_and_bind( &data, &key_name, key_algorithm, key, provider.unwrap(), ) { Ok(()) => responder.send(Status::Ok), Err(status) => responder.send(status), } }) } KeyManagerRequest::SealData { plain_text: _, responder } => { responder.send(Status::Ok, None) } KeyManagerRequest::UnsealData { cipher_text: _, responder } => { responder.send(Status::Ok, None) } KeyManagerRequest::DeleteKey { key_name: _, responder } => responder.send(Status::Ok), } } /// Bind an in_memory asymmetric key object to a channel initiated by user. /// /// # Arguments /// /// * `key_name` - The name for the key to bind. /// * `key_to_bind` - The in memory key object to bind. /// * `key` - The server end of the user channel to bind the key to. fn bind_asymmetric_key_to_server( &self, key_name: &str, key_to_bind: Arc<Mutex<dyn KmsKey>>, key: ServerEnd<AsymmetricPrivateKeyMarker>, ) -> Result<(), Status> { let mut request_stream = key.into_stream().map_err(debug_err_fn!( Status::InternalError, "Error creating AsymmetricKey request stream {:?}" ))?; // Need to clone the key_name to be move into the async function. let key_name = String::from(key_name); // Copy the key map into the async function. let key_map_ref = Arc::clone(&self.key_map); fasync::spawn_local( // Spawn async job to handle requests. async move { while let Some(r) = await!(request_stream.try_next())? { key_to_bind .lock() .unwrap() .handle_request(KeyRequestType::AsymmetricPrivateKeyRequest(r))?; } Ok(()) } .and_then(|_| { async move { Self::clean_up(key_map_ref, &key_name); Ok(()) } }) .unwrap_or_else(|e: fidl::Error| error!("Error running AsymmetricKey {:?}", e)), ); Ok(()) } /// Clean up the in memory key object if it no longer required. /// /// The key is no longer used. If it is only referenced in the key_map, remove it. This would // free the cached key data. /// /// # Arguments /// /// * `key_map` - The reference to the key object map. /// * `key_name` - The name for the key that is no longer required. fn clean_up(key_map: Arc<Mutex<HashMap<String, Arc<Mutex<dyn KmsKey>>>>>, key_name: &str) { let mut key_map = key_map.lock().unwrap(); if key_map.contains_key(key_name) { let key_only_referenced_in_map = { let key = &key_map[key_name]; Arc::strong_count(key) == 1 }; if key_only_referenced_in_map { key_map.remove(key_name); } } } /// Generate an asymmetric key object and bind the generated key to the user channel. /// /// # Arguments /// /// * `key_name` - The name for the key to be generated. /// * `key` - The server end of the user channel to bind. /// * `key_algorithm` - The algorithm for the key to be generated. /// * `provider` - The crypto provider to generate the key with. fn generate_asymmetric_key_and_bind( &self, key_name: &str, key: ServerEnd<AsymmetricPrivateKeyMarker>, key_algorithm: AsymmetricKeyAlgorithm, provider: &dyn CryptoProvider, ) -> Result<(), Status> { let key_to_bind = self.generate_asymmetric_key(key_name, key_algorithm, provider)?; self.bind_asymmetric_key_to_server(key_name, key_to_bind, key) } /// Generate an asymmetric key object. /// /// Generate an asymmetric key object, write the key data and key attributes to file. Insert the /// in memory key object into key map and return the key object. /// /// # Arguments /// /// * `key_name` - The name for the key to be generated. /// * `key_algorithm` - The algorithm for the key to be generated. /// * `provider` - The crypto provider to generate the key with. fn generate_asymmetric_key( &self, key_name: &str, key_algorithm: AsymmetricKeyAlgorithm, provider: &dyn CryptoProvider, ) -> Result<Arc<Mutex<KmsAsymmetricKey>>, Status> { self.generate_or_import_asymmetric_key(key_name, key_algorithm, provider, None) } /// Import an asymmetric key object and bind the imported key to the user channel. /// /// # Arguments /// /// * `data` - The imported key data. /// * `key_name` - The name for the key to be imported. /// * `key_algorithm` - The algorithm for the key to be imported. /// * `key` - The server end of the user channel to bind /// * `provider` - The crypto provider to parse the key with. fn import_asymmetric_private_key_and_bind( &self, data: &[u8], key_name: &str, key_algorithm: AsymmetricKeyAlgorithm, key: ServerEnd<AsymmetricPrivateKeyMarker>, provider: &dyn CryptoProvider, ) -> Result<(), Status> { let key_to_bind = self.import_asymmetric_private_key(data, &key_name, key_algorithm, provider)?; self.bind_asymmetric_key_to_server(&key_name, key_to_bind, key) } /// Import an asymmetric key object. /// /// Import an asymmetric key object, write the key data and key attributes to file. Insert the /// in memory key object into key map and return the key object. /// /// # Arguments /// /// * `data` - The imported key data. /// * `key_name` - The name for the key to be imported. /// * `key_algorithm` - The algorithm for the key to be imported. /// * `provider` - The crypto provider to parse the key with. fn import_asymmetric_private_key( &self, data: &[u8], key_name: &str, key_algorithm: AsymmetricKeyAlgorithm, provider: &dyn CryptoProvider, ) -> Result<Arc<Mutex<KmsAsymmetricKey>>, Status> { self.generate_or_import_asymmetric_key(key_name, key_algorithm, provider, Some(data)) } /// Generate or import an asymmetric key object depending on whether imported_key_data is None. fn generate_or_import_asymmetric_key( &self, key_name: &str, key_algorithm: AsymmetricKeyAlgorithm, provider: &dyn CryptoProvider, imported_key_data: Option<&[u8]>, ) -> Result<Arc<Mutex<KmsAsymmetricKey>>, Status> { // Check whether the algorithm is valid. Self::check_asymmmetric_supported_algorithms(key_algorithm, provider)?; // Create a new symmetric key object and store it into the key map. Need to make sure // we hold a mutable lock to the key_map during the whole operation to prevent dead lock. let mut key_map = self.key_map.lock().unwrap(); if key_map.contains_key(key_name) || self.key_file_exists(key_name) { return Err(Status::KeyAlreadyExists); } let new_key = match imported_key_data { Some(data) => KmsAsymmetricKey::import_key(provider, data, key_name, key_algorithm), None => KmsAsymmetricKey::new(provider, key_name, key_algorithm), }?; { self.write_key_attributes_to_file( new_key.get_key_name(), Some(new_key.get_key_algorithm()), new_key.get_key_type(), new_key.get_key_origin(), new_key.get_provider_name(), &new_key.get_key_data(), )?; } let key_to_bind = Arc::new(Mutex::new(new_key)); let key_to_insert = Arc::clone(&key_to_bind); key_map.insert(key_name.to_string(), key_to_insert); Ok(key_to_bind) } /// Get an asymmetric key object and bind it to the user channel. /// /// # Arguments /// /// * `key_name` - The name for the key to be find. /// * `key` - The server end of the user channel to bind. fn get_asymmetric_private_key_and_bind( &self, key_name: &str, key: ServerEnd<AsymmetricPrivateKeyMarker>, ) -> Result<(), Status> { let key_to_bind = self.get_asymmetric_private_key(&key_name)?; self.bind_asymmetric_key_to_server(&key_name, key_to_bind, key) } /// Get an asymmetric key object. /// /// Find the asymmetric key object for the key name in the key map. If none is found, try to /// load the key object into memory from storage. /// /// # Arguments /// /// * `key_name` - The name for the key to be find. fn get_asymmetric_private_key(&self, key_name: &str) -> Result<Arc<Mutex<dyn KmsKey>>, Status> { let mut key_map = self.key_map.lock().unwrap(); match key_map.get(key_name) { Some(key) => Ok(Arc::clone(key)), None => { // The key is not in key map, read it from file. let provider_map = self.crypto_provider_map.read().unwrap(); let key_attributes = self.read_key_attributes_from_file(key_name, &provider_map)?; let asym_key = KmsAsymmetricKey::parse_key(key_name, key_attributes)?; let key_to_bind = Arc::new(Mutex::new(asym_key)); let key_to_insert = Arc::clone(&key_to_bind); key_map.insert(key_name.to_string(), key_to_insert); Ok(key_to_bind) } } } /// Check whether a key algorithm is a valid asymmetric key algorithm and supported by provider. fn check_asymmmetric_supported_algorithms( key_algorithm: AsymmetricKeyAlgorithm, provider: &dyn CryptoProvider, ) -> Result<(), Status> { if provider .supported_asymmetric_algorithms() .iter() .find(|&alg| alg == &key_algorithm) .is_none() { // TODO: Add logic to fall back. return Err(Status::InternalError); } Ok(()) } fn get_key_attributes_path(&self, key_name: &str) -> PathBuf { Path::new(&self.key_folder).join(format!("{}.attr", key_name)) } fn key_file_exists(&self, key_name: &str) -> bool { let key_path = self.get_key_attributes_path(key_name); key_path.is_file() } fn write_key_attributes( &self, key_name: &str, serialized_key_attributes: &str, ) -> Result<(), Error> { fs::create_dir_all(&self.key_folder)?; let key_attributes_path = self.get_key_attributes_path(key_name); fs::write(key_attributes_path, serialized_key_attributes)?; Ok(()) } /// Write the key attributes to storage. /// /// If asymmetric_key_algorithm is None, this means that this is a sealing key and we do not /// care about algorithm, so we just fill algorithm number with 0. fn write_key_attributes_to_file( &self, key_name: &str, asymmetric_key_algorithm: Option<AsymmetricKeyAlgorithm>, key_type: KeyType, key_origin: KeyOrigin, provider_name: &str, key_data: &[u8], ) -> Result<(), Status> { let key_algorithm_num = match asymmetric_key_algorithm { Some(alg) => alg.into_primitive(), None => 0, }; let key_attributes = KeyAttributesJson { key_algorithm: key_algorithm_num, key_type, key_origin: key_origin.into_primitive(), provider_name: provider_name.to_string(), key_data: key_data.to_vec(), }; let key_attributes_string = serde_json::to_string(&key_attributes) .expect("Failed to encode key attributes to JSON format."); self.write_key_attributes(key_name, &key_attributes_string) .map_err(debug_err_fn!(Status::InternalError, "Failed to write key attributes: {:?}")) } fn read_key_attributes(&self, key_name: &str) -> Result<Vec<u8>, Error> { let key_attributes_path = self.get_key_attributes_path(key_name); Ok(fs::read(key_attributes_path)?) } fn read_key_attributes_from_file<'a>( &self, key_name: &str, provider_map: &'a HashMap<&'static str, Box<dyn CryptoProvider>>, ) -> Result<KeyAttributes<'a>, Status> { // Read the key attributes from file and parse it. let key_attributes_string = self.read_key_attributes(&key_name).map_err(|err| { if err.kind() == ErrorKind::NotFound { return Status::KeyNotFound; } debug_err!( Status::InternalError, "Failed to read key attributes from key file: {:?}", err ) })?; let key_attributes_string = str::from_utf8(&key_attributes_string).map_err(debug_err_fn!( Status::InternalError, "Failed to parse JSON string as UTF8: {:?}! The stored key data is corrupted!" ))?; let key_attributes_json: KeyAttributesJson = serde_json::from_str(&key_attributes_string) .map_err(debug_err_fn!( Status::InternalError, "Failed to parse key attributes: {:?}, the stored key data is corrupted!" ))?; let provider_name: &str = &key_attributes_json.provider_name; let provider = provider_map.get(provider_name).ok_or(debug_err!( Status::InternalError, "Failed to find provider! The stored key data is corrupted!" ))?; let key_type = key_attributes_json.key_type; let asymmetric_key_algorithm = Some(AsymmetricKeyAlgorithm::from_primitive(key_attributes_json.key_algorithm).ok_or( debug_err!( Status::InternalError, "Failed to convert key_algortihm! The stored key data is corrupted!" ), )?); let key_origin = KeyOrigin::from_primitive(key_attributes_json.key_origin).ok_or(debug_err!( Status::InternalError, "Failed to convert key_origin! The stored key data is corrupted!" ))?; Ok(KeyAttributes { asymmetric_key_algorithm, key_type, key_origin, provider: provider.as_ref(), key_data: key_attributes_json.key_data, }) } /// Get a crypto provider according to name and pass that provider to a function. /// /// The input function takes an Option<&dyn CryptoProvider> as argument and the output would /// be the output of this function. During the function, a read lock to the crypto_provider_map /// would be hold to prevent modification to the map. pub fn with_provider<O, F: FnOnce(Option<&dyn CryptoProvider>) -> O>( &self, name: &str, f: F, ) -> O { f(self.crypto_provider_map.read().unwrap().get(name).map(|provider| provider.as_ref())) } #[cfg(test)] pub fn add_provider(&mut self, provider: Box<dyn CryptoProvider>) { let provider_map = &mut self.crypto_provider_map.write().unwrap(); if provider_map.contains_key(provider.get_name()) { panic!("Two providers should not have the same name!"); } provider_map.insert(provider.get_name(), provider); } } #[cfg(test)] mod tests { use super::*; use crate::common::{self as common, ASYMMETRIC_KEY_ALGORITHMS}; use crate::crypto_provider::mock_provider::MockProvider; use fidl_fuchsia_kms::KeyOrigin; use tempfile::tempdir; static TEST_KEY_NAME: &str = "TestKey"; #[test] fn test_generate_asymmetric_key_mock_provider() { for algorithm in ASYMMETRIC_KEY_ALGORITHMS.iter() { generate_asymmetric_key_mock_provider(*algorithm); } } fn generate_asymmetric_key_mock_provider(key_algorithm: AsymmetricKeyAlgorithm) { let tmp_key_folder = tempdir().unwrap(); let mut key_manager = KeyManager::new(); key_manager.set_key_folder(tmp_key_folder.path().to_str().unwrap()); let test_output_data = common::generate_random_data(32); let mock_provider = Box::new(MockProvider::new()); mock_provider.set_result(&test_output_data); let key = key_manager .generate_asymmetric_key(TEST_KEY_NAME, key_algorithm, mock_provider.as_ref()) .unwrap(); let key = key.lock().unwrap(); assert_eq!(TEST_KEY_NAME, key.get_key_name()); assert_eq!(key_algorithm, key.get_key_algorithm()); assert_eq!(test_output_data, key.get_key_data()); assert_eq!(KeyOrigin::Generated, key.get_key_origin()); assert_eq!(mock_provider.get_name(), key.get_provider_name()); assert_eq!(mock_provider.get_called_key_name(), TEST_KEY_NAME); tmp_key_folder.close().unwrap(); } #[test] fn test_generate_asymmetric_key_mock_provider_error() { for algorithm in ASYMMETRIC_KEY_ALGORITHMS.iter() { generate_asymmetric_key_mock_provider_error(*algorithm); } } fn generate_asymmetric_key_mock_provider_error(key_algorithm: AsymmetricKeyAlgorithm) { let tmp_key_folder = tempdir().unwrap(); let mut key_manager = KeyManager::new(); key_manager.set_key_folder(tmp_key_folder.path().to_str().unwrap()); let mock_provider = Box::new(MockProvider::new()); mock_provider.set_error(); let result = key_manager.generate_asymmetric_key( TEST_KEY_NAME, key_algorithm, mock_provider.as_ref(), ); if let Err(Status::InternalError) = result { assert!(true); } else { assert!(false); } tmp_key_folder.close().unwrap(); } #[test] fn test_get_asymmetric_key_mock_provider() { for algorithm in ASYMMETRIC_KEY_ALGORITHMS.iter() { get_asymmetric_key_mock_provider(*algorithm); } } fn get_asymmetric_key_mock_provider(key_algorithm: AsymmetricKeyAlgorithm) { let tmp_key_folder = tempdir().unwrap(); let mut key_manager = KeyManager::new(); let mock_provider = Box::new(MockProvider::new()); let test_key_data = common::generate_random_data(32); mock_provider.set_result(&test_key_data); key_manager.add_provider(mock_provider.box_clone()); key_manager.set_key_folder(tmp_key_folder.path().to_str().unwrap()); let key_info = { let key = key_manager .generate_asymmetric_key(TEST_KEY_NAME, key_algorithm, mock_provider.as_ref()) .unwrap(); let key_info = { let key = key.lock().unwrap(); (key.get_key_name().to_string(), key.get_key_data()) }; let same_key = key_manager.get_asymmetric_private_key(TEST_KEY_NAME).unwrap(); let same_key_lock = same_key.lock().unwrap(); assert_eq!(same_key_lock.get_key_name(), &key_info.0); assert_eq!(same_key_lock.get_key_data(), key_info.1); key_info }; // Clean up the cache KeyManager::clean_up(Arc::clone(&key_manager.key_map), TEST_KEY_NAME); // If we read again, it should read from file. let new_key_to_bind = key_manager.get_asymmetric_private_key(TEST_KEY_NAME).unwrap(); let same_key_lock = new_key_to_bind.lock().unwrap(); assert_eq!(same_key_lock.get_key_name(), &key_info.0); assert_eq!(same_key_lock.get_key_data(), key_info.1); assert_eq!(mock_provider.get_called_key_data(), key_info.1); tmp_key_folder.close().unwrap(); } #[test] fn test_get_asymmetric_key_mock_provider_non_exists() { let tmp_key_folder = tempdir().unwrap(); let mut key_manager = KeyManager::new(); key_manager.add_provider(Box::new(MockProvider::new())); key_manager.set_key_folder(tmp_key_folder.path().to_str().unwrap()); // If we read again, it should read from file. let result = key_manager.get_asymmetric_private_key(TEST_KEY_NAME); if let Err(Status::KeyNotFound) = result { assert!(true); } else { assert!(false); } tmp_key_folder.close().unwrap(); } #[test] fn test_import_asymmetric_key_mock_provider() { for algorithm in ASYMMETRIC_KEY_ALGORITHMS.iter() { import_asymmetric_key_mock_provider(*algorithm); } } fn import_asymmetric_key_mock_provider(key_algorithm: AsymmetricKeyAlgorithm) { let tmp_key_folder = tempdir().unwrap(); let mut key_manager = KeyManager::new(); key_manager.set_key_folder(tmp_key_folder.path().to_str().unwrap()); let mock_provider = Box::new(MockProvider::new()); let test_input_data = common::generate_random_data(32); let test_output_data = common::generate_random_data(32); mock_provider.set_result(&test_output_data); let key = key_manager .import_asymmetric_private_key( &test_input_data, TEST_KEY_NAME, key_algorithm, mock_provider.as_ref(), ) .unwrap(); let key = key.lock().unwrap(); assert_eq!(TEST_KEY_NAME, key.get_key_name()); assert_eq!(test_output_data, key.get_key_data()); assert_eq!(key_algorithm, key.get_key_algorithm()); assert_eq!(KeyOrigin::Imported, key.get_key_origin()); assert_eq!(mock_provider.get_name(), key.get_provider_name()); assert_eq!(mock_provider.get_called_key_data(), test_input_data); assert_eq!(mock_provider.get_called_key_name(), TEST_KEY_NAME); } #[test] fn test_import_asymmetric_key_mock_already_exists() { let tmp_key_folder = tempdir().unwrap(); let mut key_manager = KeyManager::new(); key_manager.set_key_folder(tmp_key_folder.path().to_str().unwrap()); let key_algorithm = AsymmetricKeyAlgorithm::EcdsaSha512P521; let test_input_data = common::generate_random_data(32); let test_output_data = common::generate_random_data(32); let mock_provider = Box::new(MockProvider::new()); mock_provider.set_result(&test_output_data); let _key_to_bind = key_manager.import_asymmetric_private_key( &test_input_data, TEST_KEY_NAME, key_algorithm, mock_provider.as_ref(), ); let result = key_manager.import_asymmetric_private_key( &test_input_data, TEST_KEY_NAME, key_algorithm, mock_provider.as_ref(), ); if let Err(Status::KeyAlreadyExists) = result { assert!(true); } else { assert!(false); } } #[test] fn test_import_asymmetric_key_mock_already_exists_generated() { let tmp_key_folder = tempdir().unwrap(); let mut key_manager = KeyManager::new(); key_manager.set_key_folder(tmp_key_folder.path().to_str().unwrap()); let key_algorithm = AsymmetricKeyAlgorithm::EcdsaSha512P521; let test_input_data = common::generate_random_data(32); let test_output_data = common::generate_random_data(32); let mock_provider = Box::new(MockProvider::new()); mock_provider.set_result(&test_output_data); let _key_to_bind = key_manager .generate_asymmetric_key(TEST_KEY_NAME, key_algorithm, mock_provider.as_ref()) .unwrap(); let result = key_manager.import_asymmetric_private_key( &test_input_data, TEST_KEY_NAME, key_algorithm, mock_provider.as_ref(), ); if let Err(Status::KeyAlreadyExists) = result { assert!(true); } else { assert!(false); } } }
use crate::contract::transcode::Transcoder; use crate::primitives; use substrate_subxt::{ balances::Balances, contracts::*, system::System, ClientBuilder, Error, ExtrinsicSuccess, IndracoreNodeRuntime, }; pub struct ContarctCall { pub name: String, pub args: Vec<String>, pub metadata: String, pub signer: primitives::Sr25519, pub value: <IndracoreNodeRuntime as Balances>::Balance, pub gas_limit: u64, pub contract: <IndracoreNodeRuntime as System>::Address, } impl ContarctCall { async fn call(&self, data: Vec<u8>) -> Result<ExtrinsicSuccess<IndracoreNodeRuntime>, Error> { let client = match ClientBuilder::<IndracoreNodeRuntime>::new() .set_url(primitives::url()) .build() .await { Ok(cli) => cli, Err(e) => return Err(e), }; let extrinsic_success = client .call_and_watch( &self.signer, &self.contract, self.value, self.gas_limit, &data, ) .await?; Ok(extrinsic_success) } pub fn run(&self) -> Result<ExtrinsicSuccess<IndracoreNodeRuntime>, Error> { let metadata = match super::load_metadata(&self.metadata) { Ok(m) => m, Err(e) => return Err(Error::Other(format!("{:?}", e))), }; let transcoder = Transcoder::new(metadata); let data = match transcoder.encode(&self.name, &self.args) { Ok(m) => m, Err(e) => return Err(Error::Other(format!("{:?}", e))), }; let result = async_std::task::block_on(self.call(data))?; Ok(result) } }
/* Copyright 2020 Timo Saarinen 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 super::*; /// GGA - time, position, and fix related data #[derive(Clone, Debug, PartialEq)] pub struct GgaData { /// Navigation system pub source: NavigationSystem, /// UTC of position fix pub timestamp: Option<DateTime<Utc>>, /// Latitude in degrees pub latitude: Option<f64>, /// Longitude in degrees pub longitude: Option<f64>, /// GNSS Quality indicator pub quality: GgaQualityIndicator, /// Number of satellites in use pub satellite_count: Option<u8>, /// Horizontal dilution of position pub hdop: Option<f64>, /// Altitude above mean sea level (metres) pub altitude: Option<f64>, /// Height of geoid (mean sea level) above WGS84 ellipsoid pub geoid_separation: Option<f64>, /// Age of differential GPS data record, Type 1 or Type 9. pub age_of_dgps: Option<f64>, /// Reference station ID, range 0000-4095 pub ref_station_id: Option<u16>, } impl LatLon for GgaData { fn latitude(&self) -> Option<f64> { self.latitude } fn longitude(&self) -> Option<f64> { self.longitude } } /// GGA GPS quality indicator #[derive(Clone, Copy, Debug, PartialEq)] pub enum GgaQualityIndicator { Invalid, // 0 GpsFix, // 1 DGpsFix, // 2 PpsFix, // 3 RealTimeKinematic, // 4 RealTimeKinematicFloat, // 5 DeadReckoning, // 6 ManualInputMode, // 7 SimulationMode, // 8 } impl GgaQualityIndicator { pub fn new(a: u8) -> GgaQualityIndicator { match a { 0 => GgaQualityIndicator::Invalid, 1 => GgaQualityIndicator::GpsFix, 2 => GgaQualityIndicator::DGpsFix, 3 => GgaQualityIndicator::PpsFix, 4 => GgaQualityIndicator::RealTimeKinematic, 5 => GgaQualityIndicator::RealTimeKinematicFloat, 6 => GgaQualityIndicator::DeadReckoning, 7 => GgaQualityIndicator::ManualInputMode, 8 => GgaQualityIndicator::SimulationMode, _ => GgaQualityIndicator::Invalid, } } } impl std::fmt::Display for GgaQualityIndicator { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { GgaQualityIndicator::Invalid => write!(f, "invalid"), GgaQualityIndicator::GpsFix => write!(f, "GPS fix"), GgaQualityIndicator::DGpsFix => write!(f, "DGPS fix"), GgaQualityIndicator::PpsFix => write!(f, "PPS fix"), GgaQualityIndicator::RealTimeKinematic => write!(f, "Real-Time Kinematic"), GgaQualityIndicator::RealTimeKinematicFloat => { write!(f, "Real-Time Kinematic (floating point)") } GgaQualityIndicator::DeadReckoning => write!(f, "dead reckoning"), GgaQualityIndicator::ManualInputMode => write!(f, "manual input mode"), GgaQualityIndicator::SimulationMode => write!(f, "simulation mode"), } } } // ------------------------------------------------------------------------------------------------- /// xxGGA: Global Positioning System Fix Data pub(crate) fn handle( sentence: &str, nav_system: NavigationSystem, ) -> Result<ParsedMessage, ParseError> { let now: DateTime<Utc> = Utc::now(); let split: Vec<&str> = sentence.split(',').collect(); Ok(ParsedMessage::Gga(GgaData { source: nav_system, timestamp: parse_hhmmss(split.get(1).unwrap_or(&""), now).ok(), latitude: parse_latitude_ddmm_mmm( split.get(2).unwrap_or(&""), split.get(3).unwrap_or(&""), )?, longitude: parse_longitude_dddmm_mmm( split.get(4).unwrap_or(&""), split.get(5).unwrap_or(&""), )?, quality: GgaQualityIndicator::new(pick_number_field(&split, 6)?.unwrap_or(0)), satellite_count: pick_number_field(&split, 7)?, hdop: pick_number_field(&split, 8)?, altitude: pick_number_field(&split, 9)?, geoid_separation: pick_number_field(&split, 11)?, age_of_dgps: pick_number_field(&split, 13)?, ref_station_id: pick_number_field(&split, 14)?, })) } // ------------------------------------------------------------------------------------------------- #[cfg(test)] mod test { use super::*; #[test] fn test_parse_cpgga() { // General test let mut p = NmeaParser::new(); match p.parse_sentence("$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47") { Ok(ps) => { match ps { // The expected result ParsedMessage::Gga(gga) => { assert_eq!(gga.timestamp, { let now: DateTime<Utc> = Utc::now(); Some( Utc.ymd(now.year(), now.month(), now.day()) .and_hms(12, 35, 19), ) }); assert::close(gga.latitude.unwrap_or(0.0), 48.117, 0.001); assert::close(gga.longitude.unwrap_or(0.0), 11.517, 0.001); assert_eq!(gga.quality, GgaQualityIndicator::GpsFix); assert_eq!(gga.satellite_count.unwrap_or(0), 8); assert::close(gga.hdop.unwrap_or(0.0), 0.9, 0.1); assert::close(gga.altitude.unwrap_or(0.0), 545.4, 0.1); assert::close(gga.geoid_separation.unwrap_or(0.0), 46.9, 0.1); assert_eq!(gga.age_of_dgps, None); assert_eq!(gga.ref_station_id, None); } ParsedMessage::Incomplete => { assert!(false); } _ => { assert!(false); } } } Err(e) => { assert_eq!(e.to_string(), "OK"); } } // Southwest test let mut p = NmeaParser::new(); match p.parse_sentence("$GPGGA,123519,4807.0,S,01131.0,W,1,08,0.9,545.4,M,46.9,M,,") { Ok(ps) => { match ps { // The expected result ParsedMessage::Gga(gga) => { assert_eq!( (gga.latitude.unwrap_or(0.0) * 1000.0).round() as i32, -48117 ); assert_eq!( (gga.longitude.unwrap_or(0.0) * 1000.0).round() as i32, -11517 ); } ParsedMessage::Incomplete => { assert!(false); } _ => { assert!(false); } } } Err(e) => { assert_eq!(e.to_string(), "OK"); } } // Empty fields test let mut p = NmeaParser::new(); match p.parse_sentence("$GPGGA,123519,,,,,,,,,,,,,*5B") { Ok(ps) => { match ps { // The expected result ParsedMessage::Gga(gga) => { assert_eq!(gga.timestamp, { let now: DateTime<Utc> = Utc::now(); Some( Utc.ymd(now.year(), now.month(), now.day()) .and_hms(12, 35, 19), ) }); assert_eq!(gga.latitude, None); assert_eq!(gga.longitude, None); assert_eq!(gga.quality, GgaQualityIndicator::Invalid); assert_eq!(gga.satellite_count, None); assert_eq!(gga.hdop, None); assert_eq!(gga.altitude, None); assert_eq!(gga.geoid_separation, None); assert_eq!(gga.age_of_dgps, None); assert_eq!(gga.ref_station_id, None); } ParsedMessage::Incomplete => { assert!(false); } _ => { assert!(false); } } } Err(e) => { assert_eq!(e.to_string(), "OK"); } } } }