pub enum PineVersion {
V3,
V4,
V5,
V6,
}Expand description
The language version a script targets, declared by the //@version=N
annotation at the top of a script.
Variants are ordered oldest → newest, so version gates read naturally and stay readable as versions are added:
use pine_core::PineVersion;
let version = PineVersion::V6;
// "namespaced builtins (`ta.sma`) exist from v5 onwards"
assert!(version >= PineVersion::V5);Variants§
Implementations§
Source§impl PineVersion
impl PineVersion
Sourcepub const LATEST: PineVersion = PineVersion::V6
pub const LATEST: PineVersion = PineVersion::V6
The newest version this toolchain supports.
Sourcepub fn from_number(n: u8) -> Option<Self>
pub fn from_number(n: u8) -> Option<Self>
The version for a //@version=N number, or None if unsupported.
Sourcepub fn detect(source: &str) -> Result<Option<Self>, VersionError>
pub fn detect(source: &str) -> Result<Option<Self>, VersionError>
Resolve the version a script targets from its //@version=N annotation.
Ok(Some(version))— a supported annotation was found.Ok(None)— the script has no annotation. What to assume is the caller’s policy; note that real Pine assumes v1 here.Err(VersionError::Unsupported)— the annotation names a version this toolchain cannot compile.
Trait Implementations§
Source§impl Clone for PineVersion
impl Clone for PineVersion
Source§fn clone(&self) -> PineVersion
fn clone(&self) -> PineVersion
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PineVersion
Source§impl Debug for PineVersion
impl Debug for PineVersion
Source§impl Default for PineVersion
impl Default for PineVersion
Source§fn default() -> PineVersion
fn default() -> PineVersion
Returns the “default value” for a type. Read more
Source§impl Display for PineVersion
impl Display for PineVersion
impl Eq for PineVersion
Source§impl Hash for PineVersion
impl Hash for PineVersion
Source§impl Ord for PineVersion
impl Ord for PineVersion
Source§fn cmp(&self, other: &PineVersion) -> Ordering
fn cmp(&self, other: &PineVersion) -> Ordering
1.21.0 (const: unstable) · 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 PineVersion
impl PartialEq for PineVersion
Source§impl PartialOrd for PineVersion
impl PartialOrd for PineVersion
impl StructuralPartialEq for PineVersion
Auto Trait Implementations§
impl Freeze for PineVersion
impl RefUnwindSafe for PineVersion
impl Send for PineVersion
impl Sync for PineVersion
impl Unpin for PineVersion
impl UnsafeUnpin for PineVersion
impl UnwindSafe for PineVersion
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