Struct DigitalDNA

Source
pub struct DigitalDNA {
    pub sequence: Vec<u8>,
    pub generation: u64,
    pub mutations: Vec<Mutation>,
    pub fitness: f64,
    pub parent_hash: Option<String>,
    pub created_at: u64,
    pub keypair: DNAKeypair,
    pub metadata: DNAMetadata,
}
Expand description

Digital DNA - The genetic foundation of TRON organisms

Fields§

§sequence: Vec<u8>

Cryptographic sequence that defines the organism’s identity

§generation: u64

Current generation number (starts at 0)

§mutations: Vec<Mutation>

List of mutations applied to this DNA

§fitness: f64

Current fitness level (0.0 to 1.0+)

§parent_hash: Option<String>

Hash of parent DNA (if created through reproduction)

§created_at: u64

Timestamp when DNA was created

§keypair: DNAKeypair

Cryptographic keypair for identity and signing

§metadata: DNAMetadata

DNA-specific metadata

Implementations§

Source§

impl DigitalDNA

Source

pub fn generate_new() -> Result<Self, DNAError>

Generate completely new DNA with random cryptographic identity

Source

pub fn from_signing_key(signing_key: SigningKey) -> Result<Self, DNAError>

Create DNA from existing signing key (for testing/reproduction)

Source

pub fn mutate(&mut self, mutation: Mutation) -> Result<(), DNAError>

Apply a mutation to the DNA

Source

pub fn generate_random_mutation(&self) -> Mutation

Generate a random mutation based on current mutation rate

Source

pub fn crossover(&self, other: &DigitalDNA) -> Result<DigitalDNA, DNAError>

Perform biological crossover with another DNA

Source

pub fn evolve_keys(&mut self, new_generation: u64) -> Result<(), DNAError>

Evolve cryptographic keys to next generation

Source

pub fn get_hash(&self) -> String

Get cryptographic hash of DNA

Source

pub fn sign_data(&self, data: &[u8]) -> Result<Vec<u8>, DNAError>

Sign data with DNA’s private key

Source

pub fn verify_signature(&self, data: &[u8], signature: &[u8]) -> bool

Verify signature with DNA’s public key

Source

pub fn genetic_distance(&self, other: &DigitalDNA) -> f64

Calculate genetic distance from another DNA

Source

pub fn update_fitness(&mut self, performance_score: f64)

Update fitness based on performance

Source

pub fn get_info(&self) -> DNAInfo

Get DNA information summary

Trait Implementations§

Source§

impl Clone for DigitalDNA

Source§

fn clone(&self) -> DigitalDNA

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DigitalDNA

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DigitalDNA

Source§

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 Serialize for DigitalDNA

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,