From 5ba31d254cd9f43a6d694cdd00600e467639aad2 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Wed, 2 Nov 2022 13:39:33 +0800 Subject: [PATCH 01/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 09e7edf2e7..40d464107d 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -60,6 +60,7 @@ fn get_nested_attr(nested: NestedMeta, oso_attrs: &mut Vec) { } fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { + println!(attr.parse_meta()); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From c25b54a217fe29a863ef29c70ea6c52561ac4e0f Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 11:10:17 +0800 Subject: [PATCH 02/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 40d464107d..e6046bda93 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -60,7 +60,7 @@ fn get_nested_attr(nested: NestedMeta, oso_attrs: &mut Vec) { } fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { - println!(attr.parse_meta()); + println!("{:?}", attr.parse_meta()); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From 26250617aa7d4e7c7ccb07c6d4701d7b671eb708 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 11:39:13 +0800 Subject: [PATCH 03/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index e6046bda93..9835c51d1e 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -60,7 +60,8 @@ fn get_nested_attr(nested: NestedMeta, oso_attrs: &mut Vec) { } fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { - println!("{:?}", attr.parse_meta()); + println!("attr: {:?}", attr); + println!("attr.parse_meta(): {:?}", attr.parse_meta()); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From 70a8ad2a5430d38c3ef19263e465b95774547eda Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 15:05:23 +0800 Subject: [PATCH 04/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 9835c51d1e..9ac03e2e21 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -62,6 +62,9 @@ fn get_nested_attr(nested: NestedMeta, oso_attrs: &mut Vec) { fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr: {:?}", attr); println!("attr.parse_meta(): {:?}", attr.parse_meta()); + println!("attr.parse_args(): {:?}", attr.parse_args()); + println!("attr.parse_inner(): {:?}", attr.parse_inner()); + println!("attr.parse_outer(): {:?}", attr.parse_outer()); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From 61cf6de1167ad21a3db15ca1b1f13ff0cbd52f9b Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 15:08:14 +0800 Subject: [PATCH 05/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 9ac03e2e21..77f6ee6a1c 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -63,7 +63,10 @@ fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr: {:?}", attr); println!("attr.parse_meta(): {:?}", attr.parse_meta()); println!("attr.parse_args(): {:?}", attr.parse_args()); - println!("attr.parse_inner(): {:?}", attr.parse_inner()); + println!( + "Attribute::parse_inner(attr): {:?}", + Attribute::parse_inner(attr) + ); println!("attr.parse_outer(): {:?}", attr.parse_outer()); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { From 63c5ddda5502a43f98a2ea9c616e95b6f6b221f9 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 15:08:59 +0800 Subject: [PATCH 06/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 77f6ee6a1c..19fb4d44a1 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -67,7 +67,11 @@ fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { "Attribute::parse_inner(attr): {:?}", Attribute::parse_inner(attr) ); - println!("attr.parse_outer(): {:?}", attr.parse_outer()); + + println!( + "Attribute::parse_outer(attr): {:?}", + Attribute::parse_outer(attr) + ); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From 9b075d4c0a48cbb647be1c68950bdf0add0ac2d6 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 15:25:24 +0800 Subject: [PATCH 07/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 19fb4d44a1..56f9e6ff38 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -63,15 +63,6 @@ fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr: {:?}", attr); println!("attr.parse_meta(): {:?}", attr.parse_meta()); println!("attr.parse_args(): {:?}", attr.parse_args()); - println!( - "Attribute::parse_inner(attr): {:?}", - Attribute::parse_inner(attr) - ); - - println!( - "Attribute::parse_outer(attr): {:?}", - Attribute::parse_outer(attr) - ); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From fb40c65d8f5cb23ba43dacf103925775ff9c6b91 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 16:13:19 +0800 Subject: [PATCH 08/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 56f9e6ff38..4612d76b42 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -61,8 +61,7 @@ fn get_nested_attr(nested: NestedMeta, oso_attrs: &mut Vec) { fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr: {:?}", attr); - println!("attr.parse_meta(): {:?}", attr.parse_meta()); - println!("attr.parse_args(): {:?}", attr.parse_args()); + println!("attr: {:?}", attr.path); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From fc4af9c6d33b109da9e82f01ee6b331f7e30979c Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 16:32:48 +0800 Subject: [PATCH 09/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 4612d76b42..7d45acc5d1 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -62,6 +62,7 @@ fn get_nested_attr(nested: NestedMeta, oso_attrs: &mut Vec) { fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr: {:?}", attr); println!("attr: {:?}", attr.path); + println!("attr: {:?}", attr.path.segments); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From 1bc208c4a8a3ec4423bd6c61716c83bb9445ad97 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 16:33:51 +0800 Subject: [PATCH 10/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 7d45acc5d1..7e5ffbc1a0 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -63,6 +63,7 @@ fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr: {:?}", attr); println!("attr: {:?}", attr.path); println!("attr: {:?}", attr.path.segments); + println!("attr: {:?}", attr.path.get_ident()); let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From 8c33362d4b99454b49b16a7aa650cc1851b2b314 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 16:51:33 +0800 Subject: [PATCH 11/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 7e5ffbc1a0..104a5c8fb7 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -61,9 +61,12 @@ fn get_nested_attr(nested: NestedMeta, oso_attrs: &mut Vec) { fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr: {:?}", attr); - println!("attr: {:?}", attr.path); - println!("attr: {:?}", attr.path.segments); - println!("attr: {:?}", attr.path.get_ident()); + println!("attr.path: {:?}", attr.path); + println!("attr.path.segments: {:?}", attr.path.segments); + println!("attr.path.get_ident(): {:?}", attr.path.get_ident()); + if let Some(ident) = attr.path.get_ident() { + println!("ident.ident: {:?}", ident.ident); + } let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { match get_single_segment(&list.path) { From 442171f3ff61bee6861fa87873fd2af9ab7e440b Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 17:07:50 +0800 Subject: [PATCH 12/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 104a5c8fb7..95fcd99ad0 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -65,7 +65,7 @@ fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr.path.segments: {:?}", attr.path.segments); println!("attr.path.get_ident(): {:?}", attr.path.get_ident()); if let Some(ident) = attr.path.get_ident() { - println!("ident.ident: {:?}", ident.ident); + println!("ident: {:?}", ident); } let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { From 83936e2fc81f8bca0b038c4e6f8f8e4016f9e615 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 17:33:31 +0800 Subject: [PATCH 13/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 95fcd99ad0..0ce8a415ff 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -66,6 +66,7 @@ fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { println!("attr.path.get_ident(): {:?}", attr.path.get_ident()); if let Some(ident) = attr.path.get_ident() { println!("ident: {:?}", ident); + println!("ident.to_string(): {:?}", ident.to_string()); } let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { From a4bac14c496608b122fe51268ff1d4ab0487af0c Mon Sep 17 00:00:00 2001 From: Siceberg Date: Thu, 3 Nov 2022 18:25:40 +0800 Subject: [PATCH 14/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 0ce8a415ff..7dca364be4 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -67,6 +67,9 @@ fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { if let Some(ident) = attr.path.get_ident() { println!("ident: {:?}", ident); println!("ident.to_string(): {:?}", ident.to_string()); + if ident.to_string() == "diesel" { + return (); + } } let meta = attr.parse_meta().unwrap(); if let Meta::List(list) = meta { From 41adc82c6512e2eb3dfd02745ef101fe391fe162 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Fri, 4 Nov 2022 09:57:26 +0800 Subject: [PATCH 15/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index 7dca364be4..cee807c2b2 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -67,7 +67,7 @@ fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { if let Some(ident) = attr.path.get_ident() { println!("ident: {:?}", ident); println!("ident.to_string(): {:?}", ident.to_string()); - if ident.to_string() == "diesel" { + if ident.to_string() != "polar" { return (); } } From c90e851e298db1c9d191d24e63f014a75166aed5 Mon Sep 17 00:00:00 2001 From: Siceberg Date: Fri, 4 Nov 2022 11:00:19 +0800 Subject: [PATCH 16/16] Update lib.rs --- languages/rust/oso-derive/src/lib.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/languages/rust/oso-derive/src/lib.rs b/languages/rust/oso-derive/src/lib.rs index cee807c2b2..ae194fe4c0 100644 --- a/languages/rust/oso-derive/src/lib.rs +++ b/languages/rust/oso-derive/src/lib.rs @@ -60,13 +60,7 @@ fn get_nested_attr(nested: NestedMeta, oso_attrs: &mut Vec) { } fn get_oso_attrs(attr: Attribute, oso_attrs: &mut Vec) { - println!("attr: {:?}", attr); - println!("attr.path: {:?}", attr.path); - println!("attr.path.segments: {:?}", attr.path.segments); - println!("attr.path.get_ident(): {:?}", attr.path.get_ident()); if let Some(ident) = attr.path.get_ident() { - println!("ident: {:?}", ident); - println!("ident.to_string(): {:?}", ident.to_string()); if ident.to_string() != "polar" { return (); }