The view a request names: `target`'s name, or `legacy` (the admin requests' display-hint string). A `target.view_id` must agree with it.
(target: Option<&ViewRef>, legacy: &str)
| 107 | /// The view a request names: `target`'s name, or `legacy` (the admin |
| 108 | /// requests' display-hint string). A `target.view_id` must agree with it. |
| 109 | fn named_view(target: Option<&ViewRef>, legacy: &str) -> Result<String, Status> { |
| 110 | let name = target |
| 111 | .and_then(|t| t.name.clone()) |
| 112 | .filter(|n| !n.is_empty()) |
| 113 | .or_else(|| (!legacy.is_empty()).then(|| legacy.to_string())) |
| 114 | .ok_or_else(|| invalid("name the target view"))?; |
| 115 | if let Some(target) = target { |
| 116 | if !target.view_id.is_empty() && target.view_id != view_ref_id(&name) { |
| 117 | return Err(invalid("target view_id and name disagree")); |
| 118 | } |
| 119 | } |
| 120 | Ok(name) |
| 121 | } |
| 122 | |
| 123 | /// The view a data op acts on: a sandbox's grant view (an explicit target |
| 124 | /// must be it, and the grant must carry `capability`), or the view a local |
no test coverage detected