microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
efd6847eb3bce5324ed84e4e62df6dd188278813

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

compiler/qsc_data_structures/src/display.rs

20lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use std::fmt::{self, Display, Formatter};
5
6/// Displays values separated by the provided string.
7pub fn join(
8 f: &mut Formatter,
9 mut vals: impl Iterator<Item = impl Display>,
10 sep: &str,
11) -> fmt::Result {
12 if let Some(v) = vals.next() {
13 v.fmt(f)?;
14 }
15 for v in vals {
16 write!(f, "{sep}")?;
17 v.fmt(f)?;
18 }
19 Ok(())
20}
21