MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / scopes_match

Function scopes_match

crates/chat-cli/src/auth/scope.rs:3–13  ·  view source on GitHub ↗
(a: &[A], b: &[B])

Source from the content-addressed store, hash-verified

1use crate::auth::consts::SCOPES;
2
3pub fn scopes_match<A: AsRef<str>, B: AsRef<str>>(a: &[A], b: &[B]) -> bool {
4 if a.len() != b.len() {
5 return false;
6 }
7
8 let mut a = a.iter().map(|s| s.as_ref()).collect::<Vec<_>>();
9 let mut b = b.iter().map(|s| s.as_ref()).collect::<Vec<_>>();
10 a.sort();
11 b.sort();
12 a == b
13}
14
15/// Checks if the given scopes match the predefined scopes.
16pub(crate) fn is_scopes<S: AsRef<str>>(scopes: &[S]) -> bool {

Callers 1

is_scopesFunction · 0.85

Calls 3

mapMethod · 0.80
lenMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected