Skip to main content

driver_manager_types/
bind_result.rs

1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use fidl_fuchsia_driver_framework as fdf;
6
7#[derive(Debug)]
8pub enum BindResult {
9    NotBound,
10    Driver(String),
11    Composite(Vec<fdf::CompositeParent>),
12}
13
14impl BindResult {
15    pub fn is_bound(&self) -> bool {
16        !matches!(self, BindResult::NotBound)
17    }
18
19    pub fn driver_url(&self) -> Option<&str> {
20        if let BindResult::Driver(url) = self { Some(url) } else { None }
21    }
22
23    pub fn composite_parents(&self) -> Option<&[fdf::CompositeParent]> {
24        if let BindResult::Composite(parents) = self { Some(parents) } else { None }
25    }
26}