Task Description: Implement the Time Struct Methods in Rust
Implement the following methods for the Time struct located in /app/:
Method: parse_from_str
Purpose: This method should accept a string representation of a date and a format string, parse the date string into a NaiveDateTime, and create a Time instance based on that parsed date (in nanoseconds).
Input: A string s (date) and a string fmt (format).
Output: Return a StarryResult<Time> where Time is created from the parsed date. If parsing fails, return an error.
Method: format
Purpose: This method should take a format string and return a DelayedFormat that formats the Time instance into a desired string representation, which is only computed when actually requested.
Input: A string fmt (format).
Output: Return a DelayedFormat which can later be converted to a String using to_string().
Method: format_string
Purpose: This method should format the Time instance into a string based on a provided format string.
Input: A format string fmt.
Output: Return a String that represents the formatted time.
Method: to_string
Purpose: This method should return a string representation of the Time instance in the format %Y-%m-%d %H:%M:%S.
Output: Return a String that represents the Time formatted as YYYY-MM-DD HH:MM:SS.
Implementation Requirements:
Ensure that all generated strings correctly represent the date and time according to their specified formats.
Thoroughly test your methods with the provided test suite to ensure correctness.
Make sure to handle any potential parsing errors gracefully and return appropriate error messages.
Use the existing test cases as guidance for expected functionality and results. Once implemented, ensure all tests pass successfully.