pub struct DeploymentId(/* private fields */);
Expand description
A Subgraph’s Deployment ID represents unique identifier for a deployed subgraph on The Graph.
This is the content ID of the subgraph’s manifest.
Implementations§
source§impl DeploymentId
impl DeploymentId
sourcepub const ZERO: Self = _
pub const ZERO: Self = _
The “zero” DeploymentId
.
This is a constant value that represents the zero ID. It is equivalent to parsing a zeroed 32-byte array.
sourcepub const fn new(bytes: B256) -> Self
pub const fn new(bytes: B256) -> Self
Create a new DeploymentId
.
Trait Implementations§
source§impl AsRef<FixedBytes<32>> for DeploymentId
impl AsRef<FixedBytes<32>> for DeploymentId
source§impl Clone for DeploymentId
impl Clone for DeploymentId
source§fn clone(&self) -> DeploymentId
fn clone(&self) -> DeploymentId
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DeploymentId
impl Debug for DeploymentId
source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Format the DeploymentId
as a debug string.
use thegraph_core::{deployment_id, DeploymentId};
const ID: DeploymentId = deployment_id!("QmSWxvd8SaQK6qZKJ7xtfxCCGoRzGnoi2WNzmJYYJW9BXY");
assert_eq!(
format!("{:?}", ID),
"DeploymentId(QmSWxvd8SaQK6qZKJ7xtfxCCGoRzGnoi2WNzmJYYJW9BXY)",
);
source§impl<'de> Deserialize<'de> for DeploymentId
impl<'de> Deserialize<'de> for DeploymentId
source§fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for DeploymentId
impl Display for DeploymentId
source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Format the DeploymentId
as CIDv0 (base58-encoded sha256-hash) string.
use thegraph_core::{deployment_id, DeploymentId};
const ID: DeploymentId = deployment_id!("QmSWxvd8SaQK6qZKJ7xtfxCCGoRzGnoi2WNzmJYYJW9BXY");
assert_eq!(format!("{}", ID), "QmSWxvd8SaQK6qZKJ7xtfxCCGoRzGnoi2WNzmJYYJW9BXY");
source§impl From<&DeploymentId> for B256
impl From<&DeploymentId> for B256
source§fn from(id: &DeploymentId) -> Self
fn from(id: &DeploymentId) -> Self
Converts to this type from the input type.
source§impl From<DeploymentId> for B256
impl From<DeploymentId> for B256
source§fn from(id: DeploymentId) -> Self
fn from(id: DeploymentId) -> Self
Converts to this type from the input type.
source§impl From<FixedBytes<32>> for DeploymentId
impl From<FixedBytes<32>> for DeploymentId
source§impl FromStr for DeploymentId
impl FromStr for DeploymentId
source§impl Hash for DeploymentId
impl Hash for DeploymentId
source§impl LowerHex for DeploymentId
impl LowerHex for DeploymentId
source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Format the DeploymentId
as a 32-byte hex string.
Note that the alternate flag, #
, adds a 0x
in front of the output.
use thegraph_core::{deployment_id, DeploymentId};
const ID: DeploymentId = deployment_id!("QmWmyoMoctfbAaiEs2G46gpeUmhqFRDW6KWo64y5r581Vz");
// Lower hex
assert_eq!(
format!("{:x}", ID),
"7d5a99f603f231d53a4f39d1521f98d2e8bb279cf29bebfd0687dc98458e7f89"
);
// Lower hex with alternate flag
assert_eq!(
format!("{:#x}", ID),
"0x7d5a99f603f231d53a4f39d1521f98d2e8bb279cf29bebfd0687dc98458e7f89"
);
source§impl Ord for DeploymentId
impl Ord for DeploymentId
source§fn cmp(&self, other: &DeploymentId) -> Ordering
fn cmp(&self, other: &DeploymentId) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for DeploymentId
impl PartialEq for DeploymentId
source§impl PartialOrd for DeploymentId
impl PartialOrd for DeploymentId
source§impl Serialize for DeploymentIdwhere
Self: Display,
impl Serialize for DeploymentIdwhere
Self: Display,
impl Copy for DeploymentId
impl Eq for DeploymentId
impl StructuralPartialEq for DeploymentId
Auto Trait Implementations§
impl Freeze for DeploymentId
impl RefUnwindSafe for DeploymentId
impl Send for DeploymentId
impl Sync for DeploymentId
impl Unpin for DeploymentId
impl UnwindSafe for DeploymentId
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)