rc-x509-client 0.1.2

Rust client for the RC X509 platform
// Copyright 2026-Present Datadog, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use tokio_util::bytes::Bytes;

/// Client build version information for the currently running instance.
#[derive(Debug, PartialEq, Clone)]
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
pub struct BuildVersion {
    // TODO(dom): implement version info
    #[cfg_attr(test, proptest(strategy = "crate::tests::arbitrary_bytes()"))]
    commit: Bytes,
}

impl BuildVersion {
    /// Return the major semver value.
    pub(crate) fn major(&self) -> u32 {
        0
    }

    /// Return the minor semver value.
    pub(crate) fn minor(&self) -> u32 {
        0
    }

    /// Return the patch semver value.
    pub(crate) fn patch(&self) -> u32 {
        0
    }

    /// Return the Git commit hash of the build as the, unencoded hash raw
    /// bytes.
    pub(crate) fn commit(&self) -> &Bytes {
        &self.commit
    }
}