Simon Sapin 10 лет назад
Родитель
Сommit
0e5e27c911
2 измененных файлов с 5 добавлено и 0 удалено
  1. 4 0
      src/origin.rs
  2. 1 0
      src/slicing.rs

+ 4 - 0
src/origin.rs

@@ -52,6 +52,10 @@ impl Origin {
         Origin::Opaque(OpaqueOrigin(Arc::new(0)))
         Origin::Opaque(OpaqueOrigin(Arc::new(0)))
     }
     }
 
 
+    pub fn is_tuple(&self) -> bool {
+        matches!(*self, Origin::Tuple(..))
+    }
+
     /// https://html.spec.whatwg.org/multipage/#ascii-serialisation-of-an-origin
     /// https://html.spec.whatwg.org/multipage/#ascii-serialisation-of-an-origin
     pub fn ascii_serialization(&self) -> String {
     pub fn ascii_serialization(&self) -> String {
         match *self {
         match *self {

+ 1 - 0
src/slicing.rs

@@ -77,6 +77,7 @@ impl Index<Range<Position>> for Url {
 /// `BeforeScheme` and `AfterFragment` are always the start and end of the entire URL,
 /// `BeforeScheme` and `AfterFragment` are always the start and end of the entire URL,
 /// so `&url[BeforeScheme..X]` is the same as `&url[..X]`
 /// so `&url[BeforeScheme..X]` is the same as `&url[..X]`
 /// and `&url[X..AfterFragment]` is the same as `&url[X..]`.
 /// and `&url[X..AfterFragment]` is the same as `&url[X..]`.
+#[derive(Copy, Clone, Debug)]
 pub enum Position {
 pub enum Position {
     BeforeScheme,
     BeforeScheme,
     AfterScheme,
     AfterScheme,