compose_lens/model/entrypoint.rs
1//! Service entrypoint forms.
2
3use super::Located;
4use crate::source::SourceSpan;
5
6/// A Compose service entrypoint with null, scalar, and list forms retained.
7#[derive(Debug, Clone, PartialEq, Eq)]
8pub enum Entrypoint {
9 /// Explicit null: use the entrypoint declared by the image.
10 Null(SourceSpan),
11 /// Scalar syntax, including an explicitly empty string.
12 String(Located<String>),
13 /// List syntax, including an explicitly empty list.
14 List {
15 /// The complete sequence span.
16 span: SourceSpan,
17 /// Entrypoint arguments in authored order.
18 values: Vec<Located<String>>,
19 },
20}
21
22impl Entrypoint {
23 /// Returns the complete entrypoint value span.
24 #[must_use]
25 pub const fn span(&self) -> SourceSpan {
26 match self {
27 Self::Null(span) | Self::List { span, .. } => *span,
28 Self::String(value) => value.span(),
29 }
30 }
31}