https://cerbos.dev logo
#community
Title
# community
a

akkaratanapatT

06/07/2023, 8:32 PM
Hi, Cerbos team I have a policy condition like this
Copy code
expr: request.resource.attr.share_read_list.exists(t, t.id == request.principal.id)
and I would like to implement it and add a list of string in resouce attr in Rust, but it said AttrVal wasn't implemented for list, vec, or iter May you give me some example of this
d

Dennis (Cerbos)

06/07/2023, 10:26 PM
Hi, you need to wrap the list into a ListVal tuple struct:
ListVal(["Alex"])
. It supports any type that implements
IntoIterator
Copy code
#[derive(Debug, Clone)]
pub struct ListVal<V, I>(pub I)
where
    V: AttrVal,
    I: IntoIterator<Item = V>;
a

akkaratanapatT

06/08/2023, 3:44 AM
thx a lot
2 Views